c/c++语言开发共享c++编译protobuf时提示LNK2001 无法解析的外部符号

在所在配置完成后编译protobuf时还是提示如下LNK2001无法解析的外部符号 “union google::protobuf::internal::EmptyString google::protobuf::internal::fixed_address_empty_string” (?fixed_address_empty_string@internal@protobuf@google@@3TEmptyString@123@A)真坑啊,各种操作猛如虎后结果还是不行。vs2017里设置如下


在所在配置完成后编译protobuf时还是提示如下

LNK2001	无法解析的外部符号 "union google::protobuf::internal::EmptyString google::protobuf::internal::fixed_address_empty_string" (?fixed_address_empty_string@internal@protobuf@google@@3TEmptyString@123@A) 

真坑啊,各种操作猛如虎后结果还是不行。

vs2017里设置如下

然后查要在引用的头文件里增加 #define PROTOBUF_USE_DLLS,但是编译时会报protobuf.lib的重定义错误,于是把PROTOBUF_USE_DLLS定义放到工程的预处理器定义里就好了。这是vs2017里的做法。

Qt编辑器设置如下

在Makefile文件中定义预编译宏定义 PROTOBUF_USE_DLLS 方法如下:

CFLAGS:= -DPROTOBUF_USE_DLLS 

而在qt的 .pro文件中添加方法如下:

DEFINES +=PROTOBUF_USE_DLLS 

c/c++开发分享c++编译protobuf时提示LNK2001 无法解析的外部符号地址:https://blog.csdn.net/alvinlyb/article/details/110952210

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/c-cdevelopment/596414.html

(0)
上一篇 2021年5月8日
下一篇 2021年5月8日

精彩推荐