c++ - 代码::积木问题

标签 c++ compiler-errors codeblocks

您好,我在 Code::Blocks 中构建程序时遇到问题。 问题是当我构建代码时,它开始给我各种不相关的错误,例如:

main.cpp:(.text+0x12): undefined reference to `system'

main.cpp:(.text+0x1e): undefined reference to `system'

main.cpp:(.text+0x37): undefined reference to `ZSt4cout'

main.cpp:(.text+0x3c): undefined reference to `ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc'

main.cpp:(.text+0x44): undefined reference to `ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_'

main.cpp:(.text+0x4c): undefined reference to `ZNSolsEPFRSoS_E'

main.cpp:(.text+0x5b): undefined reference to `ZSt3cin'

main.cpp:(.text+0x60): undefined reference to `ZNSirsERd'

main.cpp:(.text+0xaf): undefined reference to `ZSt4cout'

main.cpp:(.text+0xb4): undefined reference to `ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc'

main.cpp:(.text+0xc4): undefined reference to `ZNSolsEd'

....等等

问题是在我在我的 Ubuntu 11.04 中编辑相同的程序之前它在 Windows 7 上运行没有问题。我只是不知道有什么方法可以解决这个问题。任何帮助表示赞赏。哦,如果你想要代码就问我,我会把它贴出来。我现在不做,因为这个问题已经够长了。

最佳答案

我看到两种可能性:

a) 更有可能:您尝试在没有make clean 的情况下在 Win7 和 Linux 共享的位置编译您的项目。编译器生成的目标文件在每个平台上都不同,因此您尝试链接不兼容的目标文件。只需执行 全部重建

b) 不太可能:项目可能被设置为纯 C,而您尝试将其编译为 C++。那么,正确的决定就是正确地重新创建项目。

关于c++ - 代码::积木问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6865011/

相关文章:

c++ - ConnectNamedPipe 和 asio overlapped ptr

c - 147次递归调用后,发生段错误。 (在C中)

visual-c++ - 在VC6中构建,需要unsigned long long

python - 运行使用py2exe编译的可执行文件时出错

ubuntu - 有没有办法将winsock lib从windows移动到ubuntu?

c - 如何从 Code::Blocks 的输出窗口中删除与执行相关的文本

c++ - 使用包含 std::unique_ptr 的结构的 std::vector 声明类时出错

c++ - 在 C++ 中返回对象

c++ - 错误: error C2663: 'std::_Tree<_Traits>::insert' : 2 overloads have no legal conversion for 'this' pointer

c# - 无法通过嵌套类型 'FormMain' 访问外部类型 'FormMain.ImageDelegateClass' 的非静态成员