简体   繁体   中英

Code::Blocks building problem

Hi I have a problem building a program in 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+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'

....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. 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 . 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 .

b) less likely: the project might be set up as pure C, and you try to compile it as C++. Then, the correct decision would be to recreate the project correctly.

Need use a 32bit compiler. mingw32 SJLJ

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM