Dev-C++编译运行socket程序出现undefined reference to 'XXX@4'等消息
2017-07-20 16:35
531 查看
在Windows下Dev-C++编译运行出现以下错误的原因是没有链接socket函数的库。
undefined reference to `WSAStartup@8'
undefined reference to `socket@12'
undefined reference to `WSACleanup@0'
undefined reference to `htons@4'
undefined reference to `htonl@4'
undefined reference to `bind@12'
undefined reference to `closesocket@4'
undefined reference to `WSACleanup@0'
undefined reference to `ntohs@4'
undefined reference to `inet_ntoa@4'
undefined reference to `listen@8'
undefined reference to `closesocket@4'
undefined reference to `WSACleanup@0'
undefined reference to `accept@12'
undefined reference to `closesocket@4'
undefined reference to `WSACleanup@0'
undefined reference to `ntohs@4'
undefined reference to `inet_ntoa@4'
undefined reference to `recv@16'
undefined reference to `closesocket@4'
undefined reference to `WSACleanup@0'
解决办法是在Dev-C++的任务栏 -> 工具 -> 编译选项 -> 在连接器命令行加入以下命令中添加一条编译指令:
-lwsock32
undefined reference to `WSAStartup@8'
undefined reference to `socket@12'
undefined reference to `WSACleanup@0'
undefined reference to `htons@4'
undefined reference to `htonl@4'
undefined reference to `bind@12'
undefined reference to `closesocket@4'
undefined reference to `WSACleanup@0'
undefined reference to `ntohs@4'
undefined reference to `inet_ntoa@4'
undefined reference to `listen@8'
undefined reference to `closesocket@4'
undefined reference to `WSACleanup@0'
undefined reference to `accept@12'
undefined reference to `closesocket@4'
undefined reference to `WSACleanup@0'
undefined reference to `ntohs@4'
undefined reference to `inet_ntoa@4'
undefined reference to `recv@16'
undefined reference to `closesocket@4'
undefined reference to `WSACleanup@0'
解决办法是在Dev-C++的任务栏 -> 工具 -> 编译选项 -> 在连接器命令行加入以下命令中添加一条编译指令:
-lwsock32
相关文章推荐
- 使用g++编译C/C++程序,链接时出现undefined reference to错误
- ubuntu下 GCC编译程序出现 undefined reference to `std::ios_base::Init::Init()'问题——gcc编译C++代码
- ubuntu下 GCC编译程序出现 undefined reference to `std::ios_base::Init::Init()'问题
- ubuntu下 GCC编译程序出现 undefined reference to `std::ios_base::Init::Init()'问题
- 编译程序出现 undefined reference to `__gxx_personality_v0' 错误
- ubuntu下 GCC编译程序出现 undefined reference to `std::ios_base::Init::Init()'问题
- ubuntu下 GCC编译程序出现 undefined reference to `std::ios_base::Init::Init()'问题
- Linux下编译C++程序遇到错误:undefined reference to `*::*
- 编译C++程序遇到错误:undefined reference to `*::*
- C++ 编译出现undefined reference to `vtable for Class 和 undefined reference to typeinfo for Class
- Linux下eclipse编译C/C++程序遇到 undefined reference to `pthread_create'的异常解决办法
- GCC编译程序出现 undefined reference to `std::ios_base::Init::Init()'问题
- ubuntu下 GCC编译程序出现 undefined reference to `std::ios_base::Init::Init()'问题
- Linux下基于opencv程序编译时,出现undefined reference to `cv::SIFT::SIFT(int, int, double, double, double)
- Linux下编译C++程序遇到错误:undefined reference to '***'
- ubuntu编译出现:undefined reference to `curl_global_init'
- nios ii 13 主程序的函数可以用Open Declaration 查看,但是编译的时候却说 undefined reference to 。。。这是为什么?
- Eclipse For C++编译报错 undefined reference to 'WinMain@16'
- 编译内核出现问题: undefined reference to `__gnu_mcount_nc'
- osX下编译c++程序出现Undefined symbols for architecture x86_64的原因及解决