当前位置:网站首页>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")
边栏推荐
- Leetcode skimming: binary tree 27 (delete nodes in the binary search tree)
- JS判断一个对象是否为空
- 如何让electorn打开的新窗口在window任务栏上面
- 飞桨EasyDL实操范例:工业零件划痕自动识别
- Enterprise custom form engine solution (XII) -- experience code directory structure
- 企业级自定义表单引擎解决方案(十二)--体验代码目录结构
- 基于鲲鹏原生安全,打造安全可信的计算平台
- 通过Keil如何查看MCU的RAM与ROM使用情况
- Lingyunguang of Dachen and Xiaomi investment is listed: the market value is 15.3 billion, and the machine is implanted into the eyes and brain
- 高瓴投的澳斯康生物冲刺科创板:年营收4.5亿 丢掉与康希诺合作
猜你喜欢
![《ASP.NET Core 6框架揭秘》样章[200页/5章]](/img/4f/5688c391dd19129d912a3557732047.jpg)
《ASP.NET Core 6框架揭秘》样章[200页/5章]

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

自定义线程池拒绝策略

Awk of three swordsmen in text processing

Practical example of propeller easydl: automatic scratch recognition of industrial parts

COSCon'22 社区召集令来啦!Open the World,邀请所有社区一起拥抱开源,打开新世界~

【无标题】

Isprs2021/ remote sensing image cloud detection: a geographic information driven method and a new large-scale remote sensing cloud / snow detection data set
![[untitled]](/img/6c/df2ebb3e39d1e47b8dd74cfdddbb06.gif)
[untitled]

Aosikang biological sprint scientific innovation board of Hillhouse Investment: annual revenue of 450million yuan, lost cooperation with kangxinuo
随机推荐
How does MySQL create, delete, and view indexes?
【无标题】
【无标题】
leecode3. 无重复字符的最长子串
Cmu15445 (fall 2019) project 2 - hash table details
PACP学习笔记三:PCAP方法说明
Users, groups, and permissions
Creation and assignment of graphic objects
RecyclerView的数据刷新
【学习笔记】zkw 线段树
处理链中断后如何继续/子链出错removed from scheduling
Find ID value MySQL in string
HZOJ #235. Recursive implementation of exponential enumeration
JNA学习笔记一:概念
SSM框架搭建的步骤
学习突围2 - 关于高效学习的方法
测试下摘要
Shortcut key of Bash
test
2022-07-07 Daily: Ian Goodfellow, the inventor of Gan, officially joined deepmind