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
Background Information
I’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 this is the log I getting:
> Compiler: Default compiler > Building Makefile: "C:\Soft\GAUL\Makefile.win" > Executing make... > make.exe -f > "C:\Soft\GAUL\Makefile.win" all > **gcc.exe ../gaul-devel-windows/examples/struggle.o -o "struggle.exe" -L"C:/Dev-Cpp/lib" gaul-util.a gaul-devel.a** > > gaul-util.a(memory_util.o)(.text+0x2e):memory_util.c: undefined reference to '_imp__mem_chunk_new_real' > gaul-util.a(memory_util.o)(.text+0x6c):memory_util.c: undefined reference to '_imp__mem_chunk_free_real' > ... > gaul-devel.a(ga_core.o)(.text+0x101):ga_core.c: undefined reference to 'slink_free_all' > gaul-devel.a(ga_core.o)(.text+0x360):ga_core.c: undefined reference to 'mem_chunk_new_real' > ... > collect2: ld returned 1 > exit status > > make.exe: *** [struggle.exe] Error 1 > > Execution terminated
I think that it has something to do with the parameters being used in the gcc
command.
Actual Status I’ve tried: – Copying the libraries to C:\Dev-Cpp\lib – Using the whole address before the libraries names – Using -l before the libaries names
– Not using .a
after the names
Not successful results with any of those.
Could anyone point me in the right direction?
Thanks in advance.
-
At the End as @ThiefMaster? said I used a newer builder in this case VC++ and it just worked!
-
The order of the arguments for linker (ld) is important. If your build fails on the
gcc.exe ../gaul-devel-windows/examples/struggle.o -o "struggle.exe" -L"C:/Dev-Cpp/lib" gaul-util.a gaul-devel.a
line, then try reversing the order of the last two files:
gcc.exe ../gaul-devel-windows/examples/struggle.o -o "struggle.exe" -L"C:/Dev-Cpp/lib" gaul-devel.a gaul-util.a
Originally posted 2013-11-27 12:09:46.