MinGW et linking de winsock2
Bonjour j'ai un probleme de liens quand je fait l'operation suivante avec le compilateur MinGW:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
gcc -Iinclude -D_DEBUG -O0 -g3 -Wall -c -fmessage-length=0 -c src/s400server.c -o Debug/s400server.o
gcc -Iinclude -D_DEBUG -O0 -g3 -Wall -c -fmessage-length=0 -c src/UDP_Packet.c -o Debug/UDP_Packet.o
gcc -Iinclude -D_DEBUG -O0 -g3 -Wall -c -fmessage-length=0 -c src/UDP_Socket.c -o Debug/UDP_Socket.o
g++ -lwsock32 -Wl,--subsystem,windows -mwindows -mno-cygwin -o S4NPSimu.exe Debug/s400server.o
Debug/UDP_Socket.o: In function `initSocket':
D:/projects/S4NPSimu/src/UDP_Socket.c:17: undefined reference to `WSAStartup@8'
Debug/UDP_Socket.o: In function `endSocket':
D:/projects/S4NPSimu/src/UDP_Socket.c:33: undefined reference to `WSACleanup@0'
Debug/UDP_Socket.o: In function `CreateUDPSocket':
D:/projects/S4NPSimu/src/UDP_Socket.c:53: undefined reference to `socket@12'
Debug/UDP_Socket.o: In function `CreateUDPSocketServer':
D:/projects/S4NPSimu/src/UDP_Socket.c:69: undefined reference to `bind@12'
Debug/UDP_Socket.o: In function `ReleaseUDPSocket':
.... |
Dans le fichier UDP_Socket.h j'inclut
Code:
1 2 3
|
#include <windows.h>
#include <winsock2.h> |
Donc je devrais bien linker avec C:\MinGW\lib\libwsock32.a, mais bizarement ca ne marche pas ...??