【发布时间】:2013-09-20 22:58:25
【问题描述】:
当我尝试运行以下代码时
#include<iostream>
using namespace std;
class Rectangle
{
public:
int x,y;
Rectangle(int a,int b)
{
x=a;
y=b;
}
int area()
{
return x*y;
}
};
int main()
{
Rectangle a(3,4);
cout<<a.area()<<" "<<endl;
return 0;
}
我收到这个错误
1>------ Build started: Project: project_class, Configuration: Debug Win32 ------
1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
请帮我澄清这个错误的原因
【问题讨论】:
-
查看这个 SO 答案:stackoverflow.com/a/10890428/2619912
-
您需要安装VS2010 service pack 1。
-
源代码中的任何内容都不会导致该问题。您的构建环境可能有问题。当您尝试构建像
int main() { }这样的琐碎程序时会发生什么? -
非常感谢我修复了它
标签: c++ visual-c++