当前位置:网站首页>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")
边栏推荐
- Talk about four cluster schemes of redis cache, and their advantages and disadvantages
- regular expression
- File operation command
- Design and implementation of communication protocol
- 高瓴投的澳斯康生物冲刺科创板:年营收4.5亿 丢掉与康希诺合作
- Grep of three swordsmen in text processing
- What kind of methods or functions can you view the laravel version of a project?
- Cookie
- Star Enterprise Purdue technology layoffs: Tencent Sequoia was a shareholder who raised more than 1billion
- 认养一头牛冲刺A股:拟募资18.5亿 徐晓波持股近40%
猜你喜欢

智云健康上市:市值150亿港元 SIG经纬与京新基金是股东

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

Aosikang biological sprint scientific innovation board of Hillhouse Investment: annual revenue of 450million yuan, lost cooperation with kangxinuo

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

ISPRS2021/遥感影像云检测:一种地理信息驱动的方法和一种新的大规模遥感云/雪检测数据集

Session

Visual stdio 2017 about the environment configuration of opencv4.1

高瓴投的澳斯康生物冲刺科创板:年营收4.5亿 丢掉与康希诺合作

【学习笔记】zkw 线段树

HZOJ #240. 图形打印四
随机推荐
“新红旗杯”桌面应用创意大赛2022
[learn wechat from 0] [00] Course Overview
How to continue after handling chain interruption / sub chain error removed from scheduling
[untitled]
The URL modes supported by ThinkPHP include four common modes, pathinfo, rewrite and compatibility modes
3D content generation based on nerf
免费手机号码归属地API查询接口
ISPRS2021/遥感影像云检测:一种地理信息驱动的方法和一种新的大规模遥感云/雪检测数据集
人均瑞数系列,瑞数 4 代 JS 逆向分析
About how appium closes apps (resolved)
自定义线程池拒绝策略
【无标题】
解决缓存击穿问题
通过Keil如何查看MCU的RAM与ROM使用情况
AUTOCAD——大于180度的角度标注、CAD直径符号怎么输入?
ORACLE进阶(五)SCHEMA解惑
PACP学习笔记一:使用 PCAP 编程
Importance of database security
Leetcode brush question: binary tree 24 (the nearest common ancestor of binary tree)
Ip2long and long2ip analysis