This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Link Errors


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]