error LNK2019,error LNK2001:无法解析的外部符号
来源:互联网 发布:java开发前景 编辑:程序博客网 时间:2024/05/29 18:31
环境:win7 ,vs2010
目的:安装protobuf
问题:
test.pb.obj : error LNK2019: 无法解析的外部符号 "public: virtual __thiscall google::protobuf::MessageLite::~MessageLite(void)" (??1MessageLite@protobuf@google@@UAE@XZ),该符号在函数__unwindfunclet$??0People@protoc@@QAE@XZ$0 中被引用
1>test.pb.obj : error LNK2001: 无法解析的外部符号 "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall google::protobuf::MessageLite::InitializationErrorString(void)const " (?InitializationErrorString@MessageLite@protobuf@google@@UBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
分析原因:
lib 库没有加载,或者路径不对
解决办法:
1.用代码 :#pragma comment(lib,"libprotobuf.lib")
#pragma comment(lib,"libprotoc.lib")
2.右键->属性->连接器->输入->附加依赖项 添加libprotobuf.lib,libprotoc.lib
俩种方法都是一样的,都是在工程里面添加静态库。
扩展:
#pragma是一个很常用的关键字。
#pragma pack(n) 以n个字节对齐(struct 存在对齐补齐)。最常用的场合应该是网络处理。n 大于结构体补齐的字节时候,按照结构体补齐的字节对齐,反之则按照n字节对齐。
#pragma pop 取消n字节对齐。
- error LNK2019,error LNK2001:无法解析的外部符号
- error LNK2019: unresolved external symbol / error LNK2001: 无法解析的外部符号
- error LNK2019: 无法解析的外部符号
- error LNK2019(无法解析的外部符号)
- error LNK2019(无法解析的外部符号)
- error LNK2019: 无法解析的外部符号
- error LNK2019: 无法解析的外部符号
- error LNK2019: 无法解析的外部符号
- error LNK2019: 无法解析的外部符号
- error LNK2019: 无法解析的外部符号
- error LNK2019: 无法解析的外部符号
- error LNK2019 无法解析的外部符号
- error LNK2019: 无法解析的外部符号
- error LNK2019: 无法解析的外部符号
- error LNK2019: 无法解析的外部符号
- error LNK2019: 无法解析的外部符号
- error LNK2019: 无法解析的外部符号
- error LNK2019: 无法解析的外部符号
- hibernate映射文件出现should be mapped with insert="false" update="false"
- 浮点数比较
- GridView_Demo
- Hadoop 2.0 (YARN)中的安全机制概述
- STM32芯片选型
- error LNK2019,error LNK2001:无法解析的外部符号
- webx学习
- linux 的 System V IPC状态查看与设置
- 自定义accessoryView of UITableViewCell及访问事件
- LeetCode | Gas Station
- 基于visual Studio2013解决C语言竞赛题之1078打印日历
- MySQL 防止插入重复数据---replace into
- 财务自由
- MSB and LSB