Link Errors

Thomas Dineen tdineen@ix.netcom.com
Fri Jul 31 07:52:00 GMT 2015


Gentle People:

     I am getting the following link errors on these fairly trivial 
programs.
Please note the the code compiles and links perfectly on Solaris with gcc
with no linking command line options.

    Am I missing a -l library command line option?

    I will post the source on request.

    In what libraries are the symbols sprintf_s and WinMain@16 found?
So exactly what do I add to the command line?

     These errors seem quite strange to me in that usually google will 
tell you
what library the symbol is in and then you just add -llib to the command 
line?

    Please help I have spent hours on google have ended up exhausted and 
confused!
Written at 12:51 AM!

i686-pc-mingw32-gcc Test_Shared.c dlfcn.c -lpsapi -o Test_Shared.exe

/tmp/ccJEa2nO.o:dlfcn.c:(.text+0x2fb): undefined reference to 
`sprintf_s' and WinMain@16
collect2: error: ld returned 1 exit status


i686-pc-mingw32-gcc dlfcn.c -lpsapi -o dlfcn.o

/tmp/cc6fCJ7Q.o:dlfcn.c:(.text+0x2fb): undefined reference to `sprintf_s'
/home/tdineen/Mxe_Cross_Environment_120213/mxe/usr/lib/gcc/i686-pc-mingw32/4.8.1/../../../../i686-pc-mingw32/lib/libmingw32.a(main.o):main.c:(.text.startup+0xa7): 
undefined reference to `WinMain@16'
collect2: error: ld returned 1 exit status
Linux3%

i686-pc-mingw32-gcc Test_Lib.c -o Test_Lib.so

/home/tdineen/Mxe_Cross_Environment_120213/mxe/usr/lib/gcc/i686-pc-mingw32/4.8.1/../../../../i686-pc-mingw32/lib/libmingw32.a(main.o):main.c:(.text.startup+0xa7): 
undefined reference to `WinMain@16'
collect2: error: ld returned 1 exit status



More information about the Gcc-help mailing list