{"id":1630,"date":"2022-08-30T15:18:08","date_gmt":"2022-08-30T15:18:08","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/27\/how-to-solve-undefined-reference-to-_imp__-while-building-a-console-application-in-dev-cpp-linked-to-a-static-library-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:18:08","modified_gmt":"2022-08-30T15:18:08","slug":"how-to-solve-undefined-reference-to-_imp__-while-building-a-console-application-in-dev-cpp-linked-to-a-static-library-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/how-to-solve-undefined-reference-to-_imp__-while-building-a-console-application-in-dev-cpp-linked-to-a-static-library-collection-of-common-programming-errors\/","title":{"rendered":"How to solve undefined reference to _imp__** while building a console application in DEV-CPP linked to a static library?-Collection of common programming errors"},"content":{"rendered":"<p><strong>Background Information<\/strong><br \/>\nI&#8217;m trying to build the GAUL library according to this Instructions .<\/p>\n<p><strong>The Problem<\/strong><br \/>\nWell I have two static libraries in C, build by me in Dev-CPP Windows 7 64 bit, one referencing the other.<\/p>\n<p>And to test those I created a Console Application which referenced them.<\/p>\n<p>Well when I tried to compile this is the log I getting:<\/p>\n<pre>\n&gt; Compiler: Default compiler  \n&gt; Building Makefile: \"C:\\Soft\\GAUL\\Makefile.win\"  \n&gt; Executing  make...  \n&gt; make.exe -f  \n&gt; \"C:\\Soft\\GAUL\\Makefile.win\" all  \n&gt; **gcc.exe ..\/gaul-devel-windows\/examples\/struggle.o  -o \"struggle.exe\" -L\"C:\/Dev-Cpp\/lib\" gaul-util.a gaul-devel.a**    \n&gt;   \n&gt; gaul-util.a(memory_util.o)(.text+0x2e):memory_util.c: undefined reference to '_imp__mem_chunk_new_real'  \n&gt; gaul-util.a(memory_util.o)(.text+0x6c):memory_util.c: undefined reference to '_imp__mem_chunk_free_real'  \n&gt; ...  \n&gt; gaul-devel.a(ga_core.o)(.text+0x101):ga_core.c: undefined reference to 'slink_free_all'   \n&gt; gaul-devel.a(ga_core.o)(.text+0x360):ga_core.c: undefined reference to 'mem_chunk_new_real'  \n&gt; ...  \n&gt; collect2: ld returned 1  \n&gt; exit status\n&gt; \n&gt; make.exe: *** [struggle.exe] Error 1\n&gt; \n&gt; Execution terminated\n<\/pre>\n<p>I <strong>think<\/strong> that it has something to do with the parameters being used in the <code>gcc<\/code> command.<\/p>\n<p><strong>Actual Status<\/strong> I&#8217;ve tried: &#8211; Copying the libraries to C:\\Dev-Cpp\\lib &#8211; Using the whole address before the libraries names &#8211; Using -l before the libaries names<\/p>\n<p>&#8211; Not using <code>.a<\/code> after the names<\/p>\n<p>Not successful results with any of those.<\/p>\n<p>Could anyone point me in the right direction?<\/p>\n<p>Thanks in advance.<\/p>\n<ol>\n<li>\n<p>At the End as @ThiefMaster? said I used a newer builder in this case VC++ and it just worked!<\/p>\n<\/li>\n<li>\n<p>The order of the arguments for linker (ld) is important. If your build fails on the<\/p>\n<pre><code>gcc.exe ..\/gaul-devel-windows\/examples\/struggle.o  -o \"struggle.exe\" -L\"C:\/Dev-Cpp\/lib\" gaul-util.a gaul-devel.a\n<\/code><\/pre>\n<p>line, then try reversing the order of the last two files:<\/p>\n<pre><code>gcc.exe ..\/gaul-devel-windows\/examples\/struggle.o  -o \"struggle.exe\" -L\"C:\/Dev-Cpp\/lib\" gaul-devel.a gaul-util.a\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-27 12:09:46. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Background Information I&#8217;m trying to build the GAUL library according to this Instructions . The Problem Well I have two static libraries in C, build by me in Dev-CPP Windows 7 64 bit, one referencing the other. And to test those I created a Console Application which referenced them. Well when I tried to compile [&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-1630","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1630","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=1630"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1630\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1630"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1630"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1630"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}