c++ - __imp link errors using g++ running under mingw -
i have simple socket program i'm trying compile using g++ running in mingw (both latest versions) on win8 system. i'm getting common linker errors
undefined reference `__imp_socket' undefined reference `__imp_gethostbyname' i've tried adding -lws2_32 no luck; i.e. still can't find references. can suggest else might missing?
here's full output:
g:\source\kak>g++ -o ./test_client -lws2_32 test_client.c c:\users\kenkahn\appdata\local\temp\ccdztr9b.o:test_client.c:(.text+0x4f): undefined reference `__imp_inet_addr' c:\users\kenkahn\appdata\local\temp\ccdztr9b.o:test_client.c:(.text+0x6b): undefined reference `__imp_socket' c:\users\kenkahn\appdata\local\temp\ccdztr9b.o:test_client.c:(.text+0x8b): undefined reference `__imp_connect' d:/program files/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: c:\users\kenkahn\appdata\local\temp\ccdztr9b.o: bad reloc address 0xc in section `.xdata' collect2.exe: error: ld returned 1 exit status
try putting -lws2_32 after test_client.c parameter. linker of gcc (ld) touchy order of linkable things, why doesn't find imported functions @ link time.
Comments
Post a Comment