win7下qt error: undefined reference to `_imp__getnameinfo@28'解决

Posted jec

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了win7下qt error: undefined reference to `_imp__getnameinfo@28'解决相关的知识,希望对你有一定的参考价值。

  1. [email protected]对应着winsock2.h的getnameinfo函数
  2. 首先需要导入对应的头文件
    #ifndef WIN32
        #include <sys/socket.h>
        #include <netinet/in.h>
    #else
        //win7下的头文件  
      #include <winsock2.h>
    #include<ws2tcpip.h> #endif
  3. 在qt的.pro工程文件中添加ws2_32.lib文件即可。
    LIBS += -llibwpcap    -lws2_32

     

 

以上是关于win7下qt error: undefined reference to `_imp__getnameinfo@28'解决的主要内容,如果未能解决你的问题,请参考以下文章