{"id":1665,"date":"2022-08-30T15:18:25","date_gmt":"2022-08-30T15:18:25","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/27\/codeblocks-building-problem-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:18:25","modified_gmt":"2022-08-30T15:18:25","slug":"codeblocks-building-problem-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/codeblocks-building-problem-collection-of-common-programming-errors\/","title":{"rendered":"Code::Blocks building problem-Collection of common programming errors"},"content":{"rendered":"<p>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:<\/p>\n<blockquote>\n<p>main.cpp:(.text+0x12): undefined reference to `system&#8217;<\/p>\n<p>main.cpp:(.text+0x1e): undefined reference to `system&#8217;<\/p>\n<p>main.cpp:(.text+0x37): undefined reference to `ZSt4cout&#8217;<\/p>\n<p>main.cpp:(.text+0x3c): undefined reference to `ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc&#8217;<\/p>\n<p>main.cpp:(.text+0x44): undefined reference to `ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_&#8217;<\/p>\n<p>main.cpp:(.text+0x4c): undefined reference to `ZNSolsEPFRSoS_E&#8217;<\/p>\n<p>main.cpp:(.text+0x5b): undefined reference to `ZSt3cin&#8217;<\/p>\n<p>main.cpp:(.text+0x60): undefined reference to `ZNSirsERd&#8217;<\/p>\n<p>main.cpp:(.text+0xaf): undefined reference to `ZSt4cout&#8217;<\/p>\n<p>main.cpp:(.text+0xb4): undefined reference to `ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc&#8217;<\/p>\n<p>main.cpp:(.text+0xc4): undefined reference to `ZNSolsEd&#8217;<\/p>\n<\/blockquote>\n<p>&#8230;.and so on<\/p>\n<p>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&#8217;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&#8217;t do it now because this question is long enough.<\/p>\n<ol>\n<li>\n<p>I see two possibilities:<\/p>\n<p>a) more likely: you try to compile your project at a location shared between Win7 and Linux without <code>make clean<\/code>. The object files the compiler generates are different on each platform, thus you try to link with incompatible object files. Just do a <code>Rebuild all<\/code>.<\/p>\n<p>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.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-27 12:26:07. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>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&#8217; main.cpp:(.text+0x1e): undefined reference to `system&#8217; main.cpp:(.text+0x37): undefined reference to `ZSt4cout&#8217; main.cpp:(.text+0x3c): undefined reference to `ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc&#8217; main.cpp:(.text+0x44): undefined reference to `ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_&#8217; main.cpp:(.text+0x4c): [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1665","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1665","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1665"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1665\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1665"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1665"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}