#585 -lws2_32 and -lwsock32 don't work

closed-invalid
nobody
2004-06-03
2004-06-03
No

OS: Windows 2000 (5.00.2195 SP4)
GCC: gcc version 3.2.3 (mingw special 20030504-1)
LD: GNU ld version 2.13.90 20030111
MinGW-runtime: #define __MINGW32_VERSION 3.1
win32api: #define __W32API_VERSION 2.5

I get linker errors when trying to link -lws2_32 or
-lwsock32

C:\WINNT\system32\cmd.exe /c gcc -Wall -o socktest.exe
-lwsock32 -lws2_32 socktest.c
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/cc4gbaaa.o(.text+0x96):socktest.c:
undefined reference to `WSAStartup@8'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/cc4gbaaa.o(.text+0xca):socktest.c:
undefined reference to `gethostbyname@4'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/cc4gbaaa.o(.text+0xf1):socktest.c:
undefined reference to `WSACleanup@0'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/cc4gbaaa.o(.text+0x10e):socktest.c:
undefined reference to `socket@12'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/cc4gbaaa.o(.text+0x135):socktest.c:
undefined reference to `WSACleanup@0'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/cc4gbaaa.o(.text+0x157):socktest.c:
undefined reference to `htons@4'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/cc4gbaaa.o(.text+0x1a2):socktest.c:
undefined reference to `connect@12'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/cc4gbaaa.o(.text+0x1c8):socktest.c:
undefined reference to `closesocket@4'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/cc4gbaaa.o(.text+0x1d0):socktest.c:
undefined reference to `WSACleanup@0'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/cc4gbaaa.o(.text+0x21a):socktest.c:
undefined reference to `send@16'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/cc4gbaaa.o(.text+0x247):socktest.c:
undefined reference to `closesocket@4'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/cc4gbaaa.o(.text+0x24f):socktest.c:
undefined reference to `WSACleanup@0'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/cc4gbaaa.o(.text+0x2bb):socktest.c:
undefined reference to `recv@16'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/cc4gbaaa.o(.text+0x2e8):socktest.c:
undefined reference to `closesocket@4'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/cc4gbaaa.o(.text+0x2f0):socktest.c:
undefined reference to `WSACleanup@0'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/cc4gbaaa.o(.text+0x383):socktest.c:
undefined reference to `closesocket@4'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/cc4gbaaa.o(.text+0x38b):socktest.c:
undefined reference to `WSACleanup@0'

Discussion

  • Earnie Boyd

    Earnie Boyd - 2004-06-03
    • status: open --> closed-invalid
     
  • Earnie Boyd

    Earnie Boyd - 2004-06-03

    Logged In: YES
    user_id=15438

    Command line order.

    gcc -o foo.exe foo.c -lbar

     

Log in to post a comment.