当前位置:网站首页>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")
边栏推荐
- 货物摆放问题
- layer弹出层的关闭问题
- 红杉中国完成新一期90亿美元基金募集
- Talk about four cluster schemes of redis cache, and their advantages and disadvantages
- Star Enterprise Purdue technology layoffs: Tencent Sequoia was a shareholder who raised more than 1billion
- How to reset Firefox browser
- Test next summary
- Enterprise custom form engine solution (XII) -- experience code directory structure
- Initialization script
- File operation command
猜你喜欢

Leetcode brush questions: binary tree 19 (merge binary tree)

Sequoia China completed the new phase of $9billion fund raising

Leetcode skimming: binary tree 23 (mode in binary search tree)

通过Keil如何查看MCU的RAM与ROM使用情况

Session

线程池拒绝策略最佳实践

Sed of three swordsmen in text processing

Cookie

自定义线程池拒绝策略

. Net ultimate productivity of efcore sub table sub database fully automated migration codefirst
随机推荐
人均瑞数系列,瑞数 4 代 JS 逆向分析
2022a special equipment related management (boiler, pressure vessel and pressure pipeline) simulated examination question bank simulated examination platform operation
【学习笔记】AGC010
HZOJ #236. Recursive implementation of combinatorial enumeration
解决缓存击穿问题
Awk of three swordsmen in text processing
Shortcut key of Bash
How to reset Firefox browser
Go language learning notes - structure
Day-24 UDP, regular expression
HZOJ #240. 图形打印四
为租客提供帮助
Practical case: using MYCAT to realize read-write separation of MySQL
About how appium closes apps (resolved)
[difficult and miscellaneous]pip running suddenly appears modulenotfounderror: no module named 'pip‘
事务的七种传播行为
Leetcode skimming: binary tree 25 (the nearest common ancestor of binary search tree)
智云健康上市:市值150亿港元 SIG经纬与京新基金是股东
PHP calls the pure IP database to return the specific address
. Net ultimate productivity of efcore sub table sub database fully automated migration codefirst