views:

425

answers:

2

I have a linking problem with MinGW. These are the calls:

g++ -enable-stdcall-fixup -Wl,-enable-auto-import
    -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows
    -o debug/Simulation.exe debug/LTNetSender.o debug/main.o debug/simulation.o
    debug/moc_simulation.o  -L'c:/Programmieren/Qt/4.5.2/lib' -lmingw32
    -lqtmaind -LC:\Programmieren\Qt\boost_1_39_0\distrib\lib
    -LC:\Programmieren\MinGW\lib -llibboost_system-mgw34-mt -llibws2_32
    -lQtSqld4 -lQtGuid4 -lQtNetworkd4 -lQtCored4

C:\Programmieren\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\
    ld.exe: cannot find -llibws2_32

The MinGW library directory is included in the library path and libws2_32.a is in this directory. Why isn't the linker finding the library?

+3  A: 

I think the linker command should be -lws2_32. The "lib" and ".a" is filled in automatically.

Soo Wei Tan
the thing that is funny: I need the lib for libboost_system-mingw32-mt. Without the lib, I get a linker error. Thank you for your help.
Tobias Langner
Are you using Boost anywhere?
Soo Wei Tan
A: 

Are you sure you should be using -llibws2_32? The lib and the .a are added automagically by the linker.

Try it with -lws2_32 instead. My version of ld works with that:

pax@daemonspawn> ld -llibm
ld: cannot find -llibm

pax@daemonspawn> ld -lm
ld: warning: cannot find entry symbol _start; not setting start address
paxdiablo