2012-02-27 81 views
-4

我想使用微软的Visual Studio专业2010编译这段代码和它给了我一个生成错误LNK1120致命错误:1周无法解析的外部。 下面的代码...C++ LNK1120致命错误:1周无法解析的外部

// 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; 
} 
+3

粘贴整个错误 – 2012-02-27 00:13:38

+3

有什么无法解析的外部?这编译好。 – birryree 2012-02-27 00:13:41

+0

你的错误在别处。你没有彻底准备这个问题。 – 2012-02-27 00:16:48

回答

0

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

这,这不是问题,请粘贴整个错误消息。

相关问题