当前位置:网站首页>error LNK2019: 无法解析的外部符号
error LNK2019: 无法解析的外部符号
2022-07-07 11:09:00 【会飞的胖达喵】
创建项目选择动态链接库dll

引入代码
#pragma once
#include "pch.h"
#include <string>
#ifdef XSOCKET_EXPORTS
#define XSOCKET_API __declspec(dllexport)
#else
#define XSOCKET_API __declspec(dllimport)
#endif
class XSOCKET_API XTcp
{
public:
int CreateSocket();
bool Bind(unsigned short port);
XTcp Accept();
void Close();
int Recv(char* buf, int bufsize);
int Send(const char* buf, int bufsize);
XTcp();
virtual ~XTcp();
int socketFd = 0;
unsigned short port = 0;
char* ip[16] = {
};
};
编译错误信息
1> 正在创建库 \\192.168.3.15\code\xsocket\x64\Debug\xsocket.lib 和对象 \\192.168.3.15\code\xsocket\x64\Debug\xsocket.exp
1>XTcp.obj : error LNK2019: 无法解析的外部符号 __imp_accept,函数 "public: class XTcp __cdecl XTcp::Accept(void)" (?[email protected]@@QEAA?[email protected]) 中引用了该符号
1>XTcp.obj : error LNK2019: 无法解析的外部符号 __imp_bind,函数 "public: bool __cdecl XTcp::Bind(unsigned short)" (?[email protected]@@[email protected]) 中引用了该符号
1>XTcp.obj : error LNK2019: 无法解析的外部符号 __imp_closesocket,函数 "public: void __cdecl XTcp::Close(void)" (?[email protected]@@QEAAXXZ) 中引用了该符号
1>XTcp.obj : error LNK2019: 无法解析的外部符号 __imp_htonl,函数 "public: bool __cdecl XTcp::Bind(unsigned short)" (?[email protected]@@[email protected]) 中引用了该符号
1>XTcp.obj : error LNK2019: 无法解析的外部符号 __imp_htons,函数 "public: bool __cdecl XTcp::Bind(unsigned short)" (?[email protected]@@[email protected]) 中引用了该符号
1>XTcp.obj : error LNK2019: 无法解析的外部符号 __imp_inet_ntoa,函数 "public: class XTcp __cdecl XTcp::Accept(void)" (?[email protected]@@QEAA?[email protected]) 中引用了该符号
1>XTcp.obj : error LNK2019: 无法解析的外部符号 __imp_listen,函数 "public: bool __cdecl XTcp::Bind(unsigned short)" (?[email protected]@@[email protected]) 中引用了该符号
1>XTcp.obj : error LNK2019: 无法解析的外部符号 __imp_ntohs,函数 "public: class XTcp __cdecl XTcp::Accept(void)" (?[email protected]@@QEAA?[email protected]) 中引用了该符号
1>XTcp.obj : error LNK2019: 无法解析的外部符号 __imp_recv,函数 "public: int __cdecl XTcp::Recv(char *,int)" (?[email protected]@@[email protected]) 中引用了该符号
1>XTcp.obj : error LNK2019: 无法解析的外部符号 __imp_send,函数 "public: int __cdecl XTcp::Send(char const *,int)" (?[email protected]@@[email protected]) 中引用了该符号
1>XTcp.obj : error LNK2019: 无法解析的外部符号 __imp_socket,函数 "public: int __cdecl XTcp::CreateSocket(void)" (?[email protected]@@QEAAHXZ) 中引用了该符号
1>XTcp.obj : error LNK2019: 无法解析的外部符号 __imp_WSAStartup,函数 "public: __cdecl XTcp::XTcp(void)" (??0[email protected]@[email protected]) 中引用了该符号
1>\\192.168.3.15\code\xsocket\x64\Debug\xsocket.dll : fatal error LNK1120: 12 个无法解析的外部命令
尝试在.h文件中添加
解决方法
#pragma comment(lib,"ws2_32.lib")
边栏推荐
- 解决缓存击穿问题
- 飞桨EasyDL实操范例:工业零件划痕自动识别
- Leetcode skimming: binary tree 23 (mode in binary search tree)
- [crawler] avoid script detection when using selenium
- HZOJ #240. Graphic printing IV
- Shortcut key of Bash
- 通过Keil如何查看MCU的RAM与ROM使用情况
- MySQL导入SQL文件及常用命令
- Go语言学习笔记-结构体(Struct)
- Query whether a field has an index with MySQL
猜你喜欢

MySQL master-slave replication

Leetcode skimming: binary tree 27 (delete nodes in the binary search tree)

About the problem of APP flash back after appium starts the app - (solved)

Leetcode skimming: binary tree 25 (the nearest common ancestor of binary search tree)

. Net ultimate productivity of efcore sub table sub database fully automated migration codefirst

Leetcode skimming: binary tree 22 (minimum absolute difference of binary search tree)

Analysis of DHCP dynamic host setting protocol

详细介绍六种开源协议(程序员须知)

Master formula. (used to calculate the time complexity of recursion.)

Blog recommendation | Apache pulsar cross regional replication scheme selection practice
随机推荐
@What is the difference between resource and @autowired?
xshell评估期已过怎么办
Leetcode skimming: binary tree 25 (the nearest common ancestor of binary search tree)
高瓴投的澳斯康生物冲刺科创板:年营收4.5亿 丢掉与康希诺合作
Awk of three swordsmen in text processing
关于 appium 如何关闭 app (已解决)
Cookie and session comparison
Layer pop-up layer closing problem
Image pixel read / write operation
HZOJ #236. Recursive implementation of combinatorial enumeration
test
线程池拒绝策略最佳实践
HZOJ #236. 递归实现组合型枚举
Leetcode question brushing: binary tree 26 (insertion operation in binary search tree)
Go语言学习笔记-结构体(Struct)
[crawler] avoid script detection when using selenium
Importance of database security
TPG x AIDU|AI领军人才招募计划进行中!
【无标题】
API query interface for free mobile phone number ownership