jenkem
May 12th, 2007, 07:49 PM
I am trying to compile a simple windows application on Ubuntu fiesty using mingw-gcc. I am getting the following errors:
$ i586-mingw32msvc-gcc -lws2_32 coco.c
coco.c: In function `main':
coco.c:61: warning: return type of 'main' is not `int'
/tmp/ccxABKPU.o:coco.c:(.text+0x2f): undefined reference to `_send@16'
/tmp/ccxABKPU.o:coco.c:(.text+0x78): undefined reference to `_WSAStartup@8'
/tmp/ccxABKPU.o:coco.c:(.text+0x89): undefined reference to `_socket@12'
/tmp/ccxABKPU.o:coco.c:(.text+0xb0): undefined reference to `_inet_addr@4'
/tmp/ccxABKPU.o:coco.c:(.text+0xd4): undefined reference to `_htons@4'
/tmp/ccxABKPU.o:coco.c:(.text+0xec): undefined reference to `_connect@12'
/tmp/ccxABKPU.o:coco.c:(.text+0x12f): undefined reference to `_recv@16'
/tmp/ccxABKPU.o:coco.c:(.text+0x140): undefined reference to `_send@16'
/tmp/ccxABKPU.o:coco.c:(.text+0x172): undefined reference to `_recv@16'
/tmp/ccxABKPU.o:coco.c:(.text+0x1a9): undefined reference to `_send@16'
/tmp/ccxABKPU.o:coco.c:(.text+0x1db): undefined reference to `_recv@16'
/tmp/ccxABKPU.o:coco.c:(.text+0x22b): undefined reference to `_send@16'
/tmp/ccxABKPU.o:coco.c:(.text+0x25a): undefined reference to `_recv@16'
collect2: ld returned 1 exit status
I've tried to link with the wine DLL, with the exact same errors:
$ i586-mingw32msvc-dlltool --input-def libws2_32.def --dllname WS2_32.DLL --output-lib libws2_32
$ i586-mingw32msvc-gcc libws2_32.a coco.c
coco.c: In function `main':
coco.c:61: warning: return type of 'main' is not `int'
/tmp/ccPOcY4D.o:coco.c:(.text+0x2f): undefined reference to `_send@16'
/tmp/ccPOcY4D.o:coco.c:(.text+0x78): undefined reference to `_WSAStartup@8'
/tmp/ccPOcY4D.o:coco.c:(.text+0x89): undefined reference to `_socket@12'
/tmp/ccPOcY4D.o:coco.c:(.text+0xb0): undefined reference to `_inet_addr@4'
/tmp/ccPOcY4D.o:coco.c:(.text+0xd4): undefined reference to `_htons@4'
/tmp/ccPOcY4D.o:coco.c:(.text+0xec): undefined reference to `_connect@12'
/tmp/ccPOcY4D.o:coco.c:(.text+0x12f): undefined reference to `_recv@16'
/tmp/ccPOcY4D.o:coco.c:(.text+0x140): undefined reference to `_send@16'
/tmp/ccPOcY4D.o:coco.c:(.text+0x172): undefined reference to `_recv@16'
/tmp/ccPOcY4D.o:coco.c:(.text+0x1a9): undefined reference to `_send@16'
/tmp/ccPOcY4D.o:coco.c:(.text+0x1db): undefined reference to `_recv@16'
/tmp/ccPOcY4D.o:coco.c:(.text+0x22b): undefined reference to `_send@16'
/tmp/ccPOcY4D.o:coco.c:(.text+0x25a): undefined reference to `_recv@16'
collect2: ld returned 1 exit status
Any idea how I can rectify this problem? Thanks.
$ i586-mingw32msvc-gcc -lws2_32 coco.c
coco.c: In function `main':
coco.c:61: warning: return type of 'main' is not `int'
/tmp/ccxABKPU.o:coco.c:(.text+0x2f): undefined reference to `_send@16'
/tmp/ccxABKPU.o:coco.c:(.text+0x78): undefined reference to `_WSAStartup@8'
/tmp/ccxABKPU.o:coco.c:(.text+0x89): undefined reference to `_socket@12'
/tmp/ccxABKPU.o:coco.c:(.text+0xb0): undefined reference to `_inet_addr@4'
/tmp/ccxABKPU.o:coco.c:(.text+0xd4): undefined reference to `_htons@4'
/tmp/ccxABKPU.o:coco.c:(.text+0xec): undefined reference to `_connect@12'
/tmp/ccxABKPU.o:coco.c:(.text+0x12f): undefined reference to `_recv@16'
/tmp/ccxABKPU.o:coco.c:(.text+0x140): undefined reference to `_send@16'
/tmp/ccxABKPU.o:coco.c:(.text+0x172): undefined reference to `_recv@16'
/tmp/ccxABKPU.o:coco.c:(.text+0x1a9): undefined reference to `_send@16'
/tmp/ccxABKPU.o:coco.c:(.text+0x1db): undefined reference to `_recv@16'
/tmp/ccxABKPU.o:coco.c:(.text+0x22b): undefined reference to `_send@16'
/tmp/ccxABKPU.o:coco.c:(.text+0x25a): undefined reference to `_recv@16'
collect2: ld returned 1 exit status
I've tried to link with the wine DLL, with the exact same errors:
$ i586-mingw32msvc-dlltool --input-def libws2_32.def --dllname WS2_32.DLL --output-lib libws2_32
$ i586-mingw32msvc-gcc libws2_32.a coco.c
coco.c: In function `main':
coco.c:61: warning: return type of 'main' is not `int'
/tmp/ccPOcY4D.o:coco.c:(.text+0x2f): undefined reference to `_send@16'
/tmp/ccPOcY4D.o:coco.c:(.text+0x78): undefined reference to `_WSAStartup@8'
/tmp/ccPOcY4D.o:coco.c:(.text+0x89): undefined reference to `_socket@12'
/tmp/ccPOcY4D.o:coco.c:(.text+0xb0): undefined reference to `_inet_addr@4'
/tmp/ccPOcY4D.o:coco.c:(.text+0xd4): undefined reference to `_htons@4'
/tmp/ccPOcY4D.o:coco.c:(.text+0xec): undefined reference to `_connect@12'
/tmp/ccPOcY4D.o:coco.c:(.text+0x12f): undefined reference to `_recv@16'
/tmp/ccPOcY4D.o:coco.c:(.text+0x140): undefined reference to `_send@16'
/tmp/ccPOcY4D.o:coco.c:(.text+0x172): undefined reference to `_recv@16'
/tmp/ccPOcY4D.o:coco.c:(.text+0x1a9): undefined reference to `_send@16'
/tmp/ccPOcY4D.o:coco.c:(.text+0x1db): undefined reference to `_recv@16'
/tmp/ccPOcY4D.o:coco.c:(.text+0x22b): undefined reference to `_send@16'
/tmp/ccPOcY4D.o:coco.c:(.text+0x25a): undefined reference to `_recv@16'
collect2: ld returned 1 exit status
Any idea how I can rectify this problem? Thanks.