当前位置:网站首页>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")
边栏推荐
猜你喜欢
Creation and assignment of graphic objects
【无标题】
Sed of three swordsmen in text processing
Leetcode brush question: binary tree 24 (the nearest common ancestor of binary tree)
达晨与小米投的凌云光上市:市值153亿 为机器植入眼睛和大脑
为租客提供帮助
Differences between MySQL storage engine MyISAM and InnoDB
ISPRS2021/遥感影像云检测:一种地理信息驱动的方法和一种新的大规模遥感云/雪检测数据集
Practical example of propeller easydl: automatic scratch recognition of industrial parts
线程池拒绝策略最佳实践
随机推荐
.Net下极限生产力之efcore分表分库全自动化迁移CodeFirst
高瓴投的澳斯康生物冲刺科创板:年营收4.5亿 丢掉与康希诺合作
【无标题】
ACL 2022 | small sample ner of sequence annotation: dual tower Bert model integrating tag semantics
有什么类方法或是函数可以查看某个项目的Laravel版本的?
Creation and assignment of graphic objects
Leetcode brush questions: binary tree 19 (merge binary tree)
test
Isprs2021/ remote sensing image cloud detection: a geographic information driven method and a new large-scale remote sensing cloud / snow detection data set
How to reset Firefox browser
Leetcode brush question: binary tree 24 (the nearest common ancestor of binary tree)
Importance of database security
Four functions of opencv
Guangzhou held work safety conference
ORACLE进阶(五)SCHEMA解惑
SSM框架搭建的步骤
Talk about four cluster schemes of redis cache, and their advantages and disadvantages
HZOJ #240. 图形打印四
Users, groups, and permissions
《开源圆桌派》第十一期“冰与火之歌”——如何平衡开源与安全间的天然矛盾?