本文介绍了C++ LNK1120 致命错误:1 个未解析的外部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 MS Visual Studio Professional 2010 编译此代码,但它给了我一个构建错误 LNK1120 Fatal Error: 1 unresolved externals.这是代码...

I'm trying to compile this code using MS Visual Studio Professional 2010 and it's giving me a build error LNK1120 Fatal Error: 1 unresolved externals.Here's the code...

// Program Typos prints three integer numbers, sums the numbers, calculates
// the average, and prints the sum and the average of the three numbers.

#include <iostream>
#include <iomanip>
using namespace std;

const int ONE = 5;
const int TWO = 6;
const int THREE = 7;

int main ()
{
    int sum;
    float average;


    cout  << fixed  << showpoint;

    cout << setw(5) << ONE  << TWO  << THREE << endl;
    sum = ONE + TWO + THREE;
    average = sum / 3;
    cout  << " The sum is "  << sum  << " and the average is " \
      << average  <<endl;
    return 0;
}

推荐答案

唯一的可能性是缺少 WinMain(或其变体).要解决转到项目设置,链接器 -> 系统,然后选择 /SUBSYSTEM:CONSOLE.

The only possibility is missing WinMain (or its variant). To resolve goto Project Settings, Linker -> System, and select /SUBSYSTEM:CONSOLE.

这不是问题,请粘贴完整的错误信息.

It that's not the problem, kindly paste entire error message.

这篇关于C++ LNK1120 致命错误:1 个未解析的外部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 00:38