当前位置:网站首页>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")
边栏推荐
- @What is the difference between resource and @autowired?
- ACL 2022 | small sample ner of sequence annotation: dual tower Bert model integrating tag semantics
- 2022-07-07 Daily: Ian Goodfellow, the inventor of Gan, officially joined deepmind
- ClickHouse(03)ClickHouse怎么安装和部署
- What kind of methods or functions can you view the laravel version of a project?
- How to apply @transactional transaction annotation to perfection?
- PHP calls the pure IP database to return the specific address
- CMU15445 (Fall 2019) 之 Project#2 - Hash Table 详解
- 博文推荐|Apache Pulsar 跨地域复制方案选型实践
- 如何让electorn打开的新窗口在window任务栏上面
猜你喜欢
日本政企员工喝醉丢失46万信息U盘,公开道歉又透露密码规则
【Presto Profile系列】Timeline使用
认养一头牛冲刺A股:拟募资18.5亿 徐晓波持股近40%
Go语言学习笔记-结构体(Struct)
Leetcode skimming: binary tree 23 (mode in binary search tree)
Sample chapter of "uncover the secrets of asp.net core 6 framework" [200 pages /5 chapters]
Differences between MySQL storage engine MyISAM and InnoDB
详细介绍六种开源协议(程序员须知)
处理链中断后如何继续/子链出错removed from scheduling
Blog recommendation | Apache pulsar cross regional replication scheme selection practice
随机推荐
Steps of building SSM framework
.Net下極限生產力之efcore分錶分庫全自動化遷移CodeFirst
Adopt a cow to sprint A shares: it plans to raise 1.85 billion yuan, and Xu Xiaobo holds nearly 40%
非分区表转换成分区表以及注意事项
PHP calls the pure IP database to return the specific address
The URL modes supported by ThinkPHP include four common modes, pathinfo, rewrite and compatibility modes
Common text processing tools
Coscon'22 community convening order is coming! Open the world, invite all communities to embrace open source and open a new world~
API query interface for free mobile phone number ownership
layer弹出层的关闭问题
. Net ultimate productivity of efcore sub table sub database fully automated migration codefirst
ClickHouse(03)ClickHouse怎么安装和部署
Users, groups, and permissions
博文推荐|Apache Pulsar 跨地域复制方案选型实践
Unity 构建错误:当前上下文中不存在名称“EditorUtility”
2022-07-07 Daily: Ian Goodfellow, the inventor of Gan, officially joined deepmind
抓细抓实抓好安全生产各项工作 全力确保人民群众生命财产安全
Shortcut key of Bash
Leetcode skimming: binary tree 23 (mode in binary search tree)
Leetcode brush questions: binary tree 19 (merge binary tree)