关闭

Dev_c++下解决编译winsock和pthread 的链接问题C++&STL

807人阅读 评论(0) 收藏 举报

Dev_c++下解决编译winsock和pthread 的链接问题C++&STL

在DEV-C++中编译含WINSOCK的代码总出现这样的问题
undefined reference to `inet_addr@4'
undefined reference to `gethostbyname@4'
undefined reference to `WSAGetLastError@0'
undefined reference to `inet_ntoa@4'
undefined reference to `WSAStartup@8'
undefined reference to `inet_ntoa@4'
undefined reference to `socket@12'
undefined reference to `htons@4'
undefined reference to `bind@12'
undefined reference to `listen@8'
undefined reference to `accept@12'
undefined reference to `recv@16'
undefined reference to `send@16'
undefined reference to `shutdown@8'
undefined reference to `closesocket@4'
undefined reference to `closesocket@4'
undefined reference to `WSACleanup@0'


project->project options
-> parameters
在linker框中输入
"-lwsock32"
无引号

如果想编译多线程程序要 加 “-lpthreadGC2”
无引号

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:337800次
    • 积分:4904
    • 等级:
    • 排名:第5765名
    • 原创:154篇
    • 转载:41篇
    • 译文:0篇
    • 评论:19条
    最新评论