[英]Code::Blocks building problem
Hi I have a problem building a program in Code::Blocks.嗨,我在 Code::Blocks 中构建程序时遇到问题。 The problem is when I build the code it starts giving me all kind of unrelated errors like these:
问题是当我构建代码时,它开始给我各种不相关的错误,如下所示:
main.cpp:(.text+0x12): undefined reference to `system'
main.cpp:(.text+0x12): 对“系统”的未定义引用
main.cpp:(.text+0x1e): undefined reference to `system'
main.cpp:(.text+0x1e): 对“系统”的未定义引用
main.cpp:(.text+0x37): undefined reference to `ZSt4cout'
main.cpp:(.text+0x37): 对“ZSt4cout”的未定义引用
main.cpp:(.text+0x3c): undefined reference to `ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc'
main.cpp:(.text+0x3c): 对`ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc'的未定义引用
main.cpp:(.text+0x44): undefined reference to `ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_'
main.cpp:(.text+0x44):对`ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_'的未定义引用
main.cpp:(.text+0x4c): undefined reference to `ZNSolsEPFRSoS_E'
main.cpp:(.text+0x4c):对`ZNSolsEPFRSoS_E'的未定义引用
main.cpp:(.text+0x5b): undefined reference to `ZSt3cin'
main.cpp:(.text+0x5b): 对“ZSt3cin”的未定义引用
main.cpp:(.text+0x60): undefined reference to `ZNSirsERd'
main.cpp:(.text+0x60):对“ZNSirsERd”的未定义引用
main.cpp:(.text+0xaf): undefined reference to `ZSt4cout'
main.cpp:(.text+0xaf):对“ZSt4cout”的未定义引用
main.cpp:(.text+0xb4): undefined reference to `ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc'
main.cpp:(.text+0xb4):对`ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc'的未定义引用
main.cpp:(.text+0xc4): undefined reference to `ZNSolsEd'
main.cpp:(.text+0xc4):对“ZNSolsEd”的未定义引用
....and so on ....等等
The problem is before I edit the same program in my Ubuntu 11.04 it was running without a problem on Windows 7. I just don't know any way to fix this.问题是在我在 Ubuntu 11.04 中编辑同一个程序之前,它在 Windows 7 上运行没有问题。我只是不知道有什么方法可以解决这个问题。 Any help is appreciated.
任何帮助表示赞赏。 Oh and if you want the code just ask me and I will post it.
哦,如果你想要代码就问我,我会发布它。 I don't do it now because this question is long enough.
我现在不做,因为这个问题已经够长了。
I see two possibilities:我看到两种可能性:
a) more likely: you try to compile your project at a location shared between Win7 and Linux without make clean
. a) 更有可能:您尝试在 Win7 和 Linux 之间共享的位置编译您的项目,而没有
make clean
。 The object files the compiler generates are different on each platform, thus you try to link with incompatible object files.编译器生成的目标文件在每个平台上都不同,因此您尝试链接不兼容的目标文件。 Just do a
Rebuild all
.只需执行
Rebuild all
。
b) less likely: the project might be set up as pure C, and you try to compile it as C++. b) 不太可能:项目可能设置为纯 C,而您尝试将其编译为 C++。 Then, the correct decision would be to recreate the project correctly.
然后,正确的决定是正确地重新创建项目。
Need use a 32bit compiler.需要使用 32 位编译器。 mingw32 SJLJ
mingw32 SJLJ
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.