(IPO)全栈君每日一练

问题1:编写通信相关程序时,引用静态库(静态库编译没有问题,被其他项目引用)。 这个库是程序的一个包。 基本结构如下:

未解决的外部符号问题摘要

在属性中添加对库的引用后,编译仍然报错如下:

.lib(.obj):错误:无法解析的外部符号@4,在函数“:::::(char const *,short)”中引用(??@@@QAE@PBDF@Z)

1>.lib(.obj) : 错误 : 函数 ": ::::(char const *,short)" (??@@@QAE@PBDF@Z) 引用中无法解析的外部符号 @4

1>.lib(.obj) : 错误 : 函数 ": ::::(char const *,short)" (??@@@QAE@PBDF@Z) 中引用了无法解析的外部符号 @0

1>.lib(.obj) : 错误 : 函数 ": ::::(char const *,short)" (??@@@QAE@PBDF@Z) 中引用了无法解析的外部符号 @12

1>.lib(.obj): 错误: 函数 ": int ::::send(char const *, int)" (?send@@@@@Z ) 中引用了无法解析的外部符号 _send@16

1>.lib(.obj) : 错误 : 无法解析的外部符号 _recv@16,该符号在函数 ": int ::::(char *, int)" (?@@@@@Z) 中使用

1>.lib(.obj) : 错误 : 无法解析的外部符号 @4,在函数“: void ::::close(void)” (?close@@@@) 中引用

1>.lib(.obj) : 错误 : 无法解析的外部符号 @12,在函数 ": void ::::( *)" (?@@@@@@@Z) 中引用

1>.lib(.obj) : 错误 : 无法解析的外部符号 @20,在函数“: void ::::init(int)”中引用 (?init@@@@AAEXH@Z)

1>.lib(.obj) : 错误 : 函数 ": ::::(short, long,int)" (??@@@QAE@FKH@Z) 中引用了无法解析的外部符号 @8

1>.lib(.obj): 错误:无法解析的外部符号 _bind@12,该符号位于函数“: ::::(short, long,int)” (??@@@QAE@FKH@Z ) 中引用于

1>.lib(.obj) : 错误 : 函数 ": ::::(short, long,int)" (??@@@QAE@FKH@Z) 中引用了无法解析的外部符号 @20

1>.lib(.obj) : 错误 : 函数 ": class :: :::(void)" (?@@@@QAE?@2@XZ) 中引用了无法解析的外部符号 @12

1>.lib(.obj) : 错误 : 无法解析的外部符号 @8,在函数“:::(void)”中引用 (??@@QAE@XZ)

1>.lib(.obj) : 错误 : 无法解析的外部符号 @0,在函数“:::~(void)”中引用 (??@@QAE@XZ)

后来发现在.h文件中添加如下语句就可以了

#include #prama comment(lib, "ws2_32.lib")

复制

没关系。

结构如下:

未解决的外部符号问题摘要

但.lib已经包含在原始项目中。 何必又加进去呢。

初步解释:

静态库只是将自己项目的文件编译成.obj文件,然后将.obj文件集成到静态库中。 它不包括 .lib 的所有要求。

包含在 .lib 中。

© 版权声明
评论 抢沙发
加载中~
每日一言
不怕万人阻挡,只怕自己投降
Not afraid of people blocking, I'm afraid their surrender