当前位置:网站首页>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")
边栏推荐
- 博文推荐|Apache Pulsar 跨地域复制方案选型实践
- “新红旗杯”桌面应用创意大赛2022
- 明星企业普渡科技大裁员:曾募资超10亿 腾讯红杉是股东
- Shortcut key of Bash
- The difference between cache and buffer
- 《ASP.NET Core 6框架揭秘》样章[200页/5章]
- How to apply @transactional transaction annotation to perfection?
- @What is the difference between resource and @autowired?
- . Net ultimate productivity of efcore sub table sub database fully automated migration codefirst
- PCAP学习笔记二:pcap4j源码笔记
猜你喜欢
TPG x AIDU|AI领军人才招募计划进行中!
ISPRS2021/遥感影像云检测:一种地理信息驱动的方法和一种新的大规模遥感云/雪检测数据集
Sample chapter of "uncover the secrets of asp.net core 6 framework" [200 pages /5 chapters]
Sequoia China completed the new phase of $9billion fund raising
Leetcode brush questions: binary tree 19 (merge binary tree)
达晨与小米投的凌云光上市:市值153亿 为机器植入眼睛和大脑
Sed of three swordsmen in text processing
[crawler] avoid script detection when using selenium
Practical example of propeller easydl: automatic scratch recognition of industrial parts
Awk of three swordsmen in text processing
随机推荐
货物摆放问题
@What is the difference between resource and @autowired?
Blog recommendation | Apache pulsar cross regional replication scheme selection practice
[untitled]
【学习笔记】线段树选做
谷歌浏览器如何重置?谷歌浏览器恢复默认设置?
事务的七种传播行为
高瓴投的澳斯康生物冲刺科创板:年营收4.5亿 丢掉与康希诺合作
Leetcode skimming: binary tree 23 (mode in binary search tree)
Four functions of opencv
详解ThinkPHP支持的URL模式有四种普通模式、PATHINFO、REWRITE和兼容模式
[untitled]
[difficult and miscellaneous]pip running suddenly appears modulenotfounderror: no module named 'pip‘
API query interface for free mobile phone number ownership
Isprs2021/ remote sensing image cloud detection: a geographic information driven method and a new large-scale remote sensing cloud / snow detection data set
【无标题】
Leetcode skimming: binary tree 22 (minimum absolute difference of binary search tree)
Enterprise custom form engine solution (XII) -- experience code directory structure
About how appium closes apps (resolved)
Session