Linker can't resolve any references

Bob Cowdery
Wed Jun 23 07:19:00 GMT 2010

After further tests it seems that the linker is not pulling in static
libraries which have no references from the main code even though there
are many inter-library references. I know the linker optimise's what it
pulls in but why on earth is it ignoring references between static
libraries? Any ideas welcome as this is a new one on me.


Bob Cowdery wrote:
> Hi all,
> This is such a basic problem I must be doing something daft. I have a
> set of static libraries which I am linking into a dll. None of the
> external references seem to be getting resolved. This is on Win7 and I
> have MinGW and msys installed using the msys make. I am using Eclipse
> CDT but get the same result from the command line. Here is the start of
> the build to which I added the -v flag, but it still didn't help me. I
> know this set of libraries builds into a shared library ok because I
> have done so using Python distutils. However, this time its not Python
> at the top end so I can't use that.
> Any help would be very much appreciated.
> Regards
> Bob
> C:\LibSDR\src\c\stPlugin\Release>make all
> Building target: libstPlugin.dll
> Invoking: MinGW C Linker
> gcc -v -s -L"C:\libs\fftw"
> -L"C:\libs\libusb-win32-device-bin-\lib\gcc"
> -L"C:\libs\pthreads\Pre-built.2\lib" -L"
> C:\LibSDR\src\c\Utils\Release" -L"C:\LibSDR\src\c\RingBuffer\Debug"
> -L"C:\LibSDR\src\c\Dsp\Release" -L"C:\LibSDR\src\c\O
> zyDriver\Release" -L"C:\LibSDR\src\c\SdrMain\Release" -shared
> -o"libstPlugin.dll"  ./SDRLibPlugin.o   -lfftw3f-3 -lpthre
> adGC2 -lusb -lUtils -lRingBuffer -lDsp -lozydrv -lSdrMain
> Reading specs from c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/specs
> Configured with: ../gcc-3.4.5-20060117-3/configure --with-gcc
> --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw3
> 2 --prefix=/mingw --enable-threads --disable-nls
> --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --d
> isable-shared --enable-sjlj-exceptions --enable-libgcj
> --disable-java-awt --without-x --enable-java-gc=boehm --disable-l
> ibgcj-debug --enable-interpreter --enable-hash-synchronization
> --enable-libstdcxx-debug
> Thread model: win32
> gcc version 3.4.5 (mingw-vista special r3)
>  c:/MinGW/bin/../libexec/gcc/mingw32/3.4.5/collect2.exe --shared
> -Bdynamic -e _DllMainCRTStartup@12 --enable-auto-image-
> base -olibstPlugin.dll -s /mingw/lib/dllcrt2.o
> c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/crtbegin.o -LC:\libs\fftw -LC:\libs
> \libusb-win32-device-bin-\lib\gcc
> -LC:\libs\pthreads\Pre-built.2\lib -LC:\LibSDR\src\c\Utils\Release
> -LC:\LibSDR
> \src\c\RingBuffer\Debug -LC:\LibSDR\src\c\Dsp\Release
> -LC:\LibSDR\src\c\OzyDriver\Release -LC:\LibSDR\src\c\SdrMain\Rele
> ase -Lc:/MinGW/bin/../lib/gcc/mingw32/3.4.5 -Lc:/MinGW/bin/../lib/gcc
> -L/mingw/lib/gcc/mingw32/3.4.5 -Lc:/MinGW/bin/../l
> ib/gcc/mingw32/3.4.5/../../../../mingw32/lib
> -L/mingw/lib/gcc/mingw32/3.4.5/../../../../mingw32/lib -L/mingw/lib -Lc:/Mi
> nGW/bin/../lib/gcc/mingw32/3.4.5/../../..
> -L/mingw/lib/gcc/mingw32/3.4.5/../../.. ./SDRLibPlugin.o -lfftw3f-3
> -lpthreadG
> C2 -lusb -lUtils -lRingBuffer -lDsp -lozydrv -lSdrMain -lmingw32 -lgcc
> -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32
>  -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt
> c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/crtend.o
> C:\LibSDR\src\c\OzyDriver\Release/libozydrv.a(ozy_usb.o):ozy_usb.c:(.text+0x14):
> undefined reference to `ringb_float_cre
> ate'
> C:\LibSDR\src\c\OzyDriver\Release/libozydrv.a(ozy_usb.o):ozy_usb.c:(.text+0x25):
> undefined reference to `ringb_float_cre
> ate'
> C:\LibSDR\src\c\OzyDriver\Release/libozydrv.a(ozy_usb.o):ozy_usb.c:(.text+0x48):
> undefined reference to `safealloc'
> C:\LibSDR\src\c\OzyDriver\Release/libozydrv.a(ozy_usb.o):ozy_usb.c:(.text+0x6b):
> undefined reference to `safealloc'
> C:\LibSDR\src\c\OzyDriver\Release/libozydrv.a(ozy_usb.o):ozy_usb.c:(.text+0x8e):
> undefined reference to `safealloc'
> C:\LibSDR\src\c\OzyDriver\Release/libozydrv.a(ozy_usb.o):ozy_usb.c:(.text+0xb1):
> undefined reference to `safealloc'
> C:\LibSDR\src\c\OzyDriver\Release/libozydrv.a(ozy_usb.o):ozy_usb.c:(.text+0xd4):
> undefined reference to `safealloc'
> C:\LibSDR\src\c\OzyDriver\Release/libozydrv.a(ozy_usb.o):ozy_usb.c:(.text+0xf7):
> more undefined references to `safealloc
> ' follow
> C:\LibSDR\src\c\OzyDriver\Release/libozydrv.a(ozy_usb.o):ozy_usb.c:(.text+0x22f):
> undefined reference to `ringb_float_wr
> ite_space'
> C:\LibSDR\src\c\OzyDriver\Release/libozydrv.a(ozy_usb.o):ozy_usb.c:(.text+0x257):
> undefined reference to `ringb_float_wr
> ite'
> C:\LibSDR\src\c\OzyDriver\Release/libozydrv.a(ozy_usb.o):ozy_usb.c:(.text+0x288):
> undefined reference to `ringb_float_re
> ad_space'
> C:\LibSDR\src\c\OzyDriver\Release/libozydrv.a(ozy_usb.o):ozy_usb.c:(.text+0x2cf):
> undefined reference to `ringb_float_re
> ad'
> C:\LibSDR\src\c\OzyDriver\Release/libozydrv.a(ozy_usb.o):ozy_usb.c:(.text+0x2f1):
> undefined reference to `_imp__pthread_
> mutex_lock'
> etc etc.

More information about the Gcc-help mailing list