VS,C++ 中error LNK2001: 无法解析的外部符号 [email protected]

error LNK2001: 无法解析的外部符号 [email protected]
error LNK2001: 无法解析的外部符号 [email protected]
error LNK2001: 无法解析的外部符号 [email protected]
error LNK2001: 无法解析的外部符号 [email protected]
error LNK2001: 无法解析的外部符号 [email protected]
error LNK2001: 无法解析的外部符号 [email protected]
error LNK2001: 无法解析的外部符号 [email protected]
error LNK2001: 无法解析的外部符号 [email protected]
error LNK2001: 无法解析的外部符号 [email protected]
原因:
上述种类的问题都是因为缺少相应的库

解决方案:
方法一:在VS中“项目”——“属性”——“连接器”——“输入”——“附加依赖项”中加入相应的库,比如标题所示就是缺少ws2_32.lib
VS,C++ 中error LNK2001: 无法解析的外部符号 [email protected]
注意:配置附加依赖项的时候,若VS主界面为Release,则属性中的“配置©:”也必须是Release

方法二:
在代码中添加相应的库,格式为:
#pragma comment(lib,“ws2_32.lib”)
如图所示:
VS,C++ 中error LNK2001: 无法解析的外部符号 [email protected]