Implicit declaration of function 'getaddrinfo' on MinGW

后端 未结 3 456
醉梦人生
醉梦人生 2020-12-17 02:43

I have a C program that uses getaddrinfo(). It works as expected on Linux and Mac OS X.

I\'m in the middle of porting it to Windows.

When I comp

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-17 02:49

    Supposedly the proper way to fix this is:

    #define WINVER WindowsXP
    

    Or perhaps more sensibly adding -DWINVER=WindowsXP to your CPPFLAGS.

    Ref: http://mingw.5.n7.nabble.com/Undefined-reference-to-getaddrinfo-td5694.html

    Note: didn’t work for me however.

提交回复
热议问题