0
votes

I dont understand why g++ cannot find getnameinfo in ws2_32, nm shows that it is there. Here is the output:

$ I:/Programs/MinGW/msys/1.0/bin/sh.exe ../libtool --tag=CXX   --mode=link g++
 -g -O2 -no-undefined -version-info 16:0:0  -o libetpan.la -rpath /i/Programs/M
inGW/lib dummy.lo versioninfo.lo data-types/libdata-types.la low-level/liblow-l
evel.la driver/libdriver.la main/libmain.la engine/libengine.la windows/libarch
.la -L/i/Programs/MinGW/lib -lws2_32 -liconv
libtool: link: rm -fr  .libs/libetpan.dll.a
libtool: link: g++ -shared -nostdlib i:/programs/mingw/bin/../lib/gcc/mingw32/4.
7.0/../../../dllcrt2.o i:/programs/mingw/bin/../lib/gcc/mingw32/4.7.0/crtbegin.o
  .libs/dummy.o .libs/versioninfo.o  -Wl,--whole-archive data-types/.libs/libdat
a-types.a low-level/.libs/liblow-level.a driver/.libs/libdriver.a main/.libs/lib
main.a engine/.libs/libengine.a windows/.libs/libarch.a -Wl,--no-whole-archive
-lws2_32 -lws2_32 -lws2_32 -lws2_32 -lws2_32 -lws2_32 -L/i/Programs/MinGW/lib -l
ws2_32 /mingw/lib/libiconv.dll.a -Li:/programs/mingw/bin/../lib/gcc/mingw32/4.7.
0 -Li:/programs/mingw/bin/../lib/gcc -Li:/programs/mingw/bin/../lib/gcc/mingw32/
4.7.0/../../../../mingw32/lib -Li:/programs/mingw/bin/../lib/gcc/mingw32/4.7.0/.
./../.. -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi3
2 -lshell32 -luser32 -lws2_32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmi
ngwex -lmsvcrt i:/programs/mingw/bin/../lib/gcc/mingw32/4.7.0/crtend.o  -O2   -p
thread -o .libs/libetpan-16.dll -Wl,--enable-auto-image-base -Xlinker --out-impl
ib -Xlinker .libs/libetpan.dll.a
Creating library file: .libs/libetpan.dll.a
Warning: resolving _closesocket by linking to _closesocket@4
Use --enable-stdcall-fixup to disable these warnings
Use --disable-stdcall-fixup to disable these fixups
low-level/.libs/liblow-level.a(mailsmtp.o): In function `get_hostname':
c:\libetpan-00c7589\src\low-level\smtp/mailsmtp.c:266: undefined reference to `_
getnameinfo'
collect2.exe: error: ld returned 1 exit status

$ nm /i/Programs/MinGW/lib/libws2_32.a | grep getnameinfo
00000000 I __imp__getnameinfo@28
00000000 T _getnameinfo@28
1

1 Answers

1
votes

I needed to #define _WIN32_WINNT 0x0501