gpt4 book ai didi

c++ - Visual C++ 2010 - fatal error LNK1169 : one or more multiply defined symbols found

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:52:53 24 4
gpt4 key购买 nike

这是一个程序:

#include <iostream>
using namespace std;

int main() {
cout << "Enter a number";
int i;
cin >> i;
try {
if( i == 0 ) throw 0;
if( i == 2 ) throw "error";
} catch( int i ) {
cout << "can't divide by 0";
}
catch( ... ) {
cout << "catching other exceptions";
}
}

在编译时(Windows 7 上的 Microsoft visual C++ 2010 express),我收到错误消息:

fatal error LNK1169: one or more multiply defined symbols found

最佳答案

其实这段代码没有错误

源文件的数量可能是问题所在。在同一个编译器中将此代码作为一个新项目尝试,或者尝试从文本区域左侧的 source files 选项中删除文件(即您正在编写代码的位置)

这应该可以编译。

关于c++ - Visual C++ 2010 - fatal error LNK1169 : one or more multiply defined symbols found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6506367/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com