Eclipse c++ 中[Linker error] undefined reference to `WSAStartup@8’的解决办法
出现原因: 在Eclipse中使用MinGW编译器的API,底层调用的是windows系统的API函数,需要链接windows的库。
问题解决:
右键工程->Properties->C/C++ Build->Settings->Tool Settings->MinGW C Linker,在Command line pattern中添加标记-lws2_32,再次编译即可!
效果如下图:
![在这里插入图片描述 Eclipse c++ 中[Linker error] undefined reference to `WSAStartup@8‘的解决办法_右键](https://file.cfanz.cn/uploads/png/2023/02/01/13/2E56Q24249.png)
ends…









