error LNK2019,error LNK2001:无法解析的外部符号
2013-12-10 13:41
1506 查看
环境: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字节对齐。
目的:安装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: unresolved external symbol / error LNK2001: 无法解析的外部符号
- VS2010中error LNK2001无法解析的外部符号解决方法
- error LNK2001: 无法解析的外部符号
- 【IDE-Visual Studio】StdAfx.obj : error LNK2001: 无法解析的外部符号
- error LNK2019: 无法解析的外部符号 (解决方法)
- error LNK2001: 无法解析的外部符号 "public: virtual int __thiscall Game::LevelTwo(void)"
- 关于"error LNK2001: 无法解析的外部符号"
- error lnk2019无法解析的外部符号
- error LNK2001: 无法解析的外部符号 __imp__htonl@4(编程解决方法)
- error LNK2019 无法解析的外部符号 __imp___CrtDbgReportW
- error LNK2019: 无法解析的外部符号 __imp__DispatchMessageW@4,该符号在函数 _WinMain@16 中被引用
- error LNK2019: 无法解析的外部符号 __imp___CrtDbgReportW
- 查看静态库(.lib)和动态库(.dll)的导出函数的信息 error LNK2001: 无法解析的外部符号 _Delete
- error LNK2019: 无法解析的外部符号
- error LNK2019: 无法解析的外部符号
- error LNK2019: 无法解析的外部符号
- LINK : error LNK2001: 无法解析的外部符号 _DllMainCRTStartup
- error LNK2019: 无法解析的外部符号 _WinMain@16
- error LNK2001: 无法解析的外部符号 sqlite3_open
- error LNK2019: 无法解析的外部符号