error LNK2019: 无法解析的外部符号 "class std::vector<class std::basic_string<char,struct std::char_traits<cha

本文介绍了解决在Release版本下出现的LNK2019未解析外部符号错误的方法。错误源于自定义split函数与标准库函数冲突。通过确保包含自定义函数的类被正确引用可以避免此问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

error LNK2019: 无法解析的外部符号 "class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > __cdecl Public_Func::split(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?split@Public_Func@@YA?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@0@Z),该符号在函数 "public: virtual int __thiscall CPeopleCounting::Init(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?Init@CPeopleCounting@@UAEHAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 中被引用

在Release版本下报错,Dedug版本下没有问题,网上搜了几种方法都不能解决。

后来仔细阅读错误原因发现,是自己写的类Public_Func中重新定义了split函数,而release版本下没有包含Public_Func类,项目与c++中自带的split混淆造成的。

调用Public_Func类即可。

建议以后遇到此类错误的话,仔细阅读报错信息,一般里面都有提示。

``` struct tagMTFTesterResultAverage { string strFinal; string strSymmetricalGroupMTFExtrems; string strSymmetricalFielldMTFAverageExtrems; string strMTFAverageOfAllCameras; string strFieldPositionOfMTFAverage; string strFieldShiftSingleAverage; string strFocalShiftGroup; string strFocalShiftAverage; string strPeakRangeExtrems; string strPeakMTFExtrems; string strPeakMTFAverage; string strMTFRatioOfExtremsToMax; }; struct tagMTFTesterResult { string strFinal; // 最终结果 string strMTF; // MTF结果 string strDOF; // DOF结果 string strFocalShift; // 场曲结果 string strAstigmatism; // 像散结果 string strFOV; // FOV结果 tagMTFTesterResultAverage m_Average; // 均值管控测试结果 string strAggregate; // 综合结果 string strMultiFrqMTF; // 辅助频率结果 string strFail_Reason; // 失败原因 };```1>CSocketClientTester.obj : error LNK2005: "void __cdecl from_json(class nlohmann::json_abi_v3_11_3::basic_json<class std::map,class std::vector,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,bool,__int64,unsigned __int64,double,class std::allocator,struct nlohmann::json_abi_v3_11_3::adl_serializer,class std::vector<unsigned char,class std::allocator<unsigned char> >,void> const &,struct tagMTFTesterResult &)" (?from_json@@YAXAEBV?$basic_json@Vmap@std@@Vvector@2@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@_N_J_KNVallocator@2@Uadl_serializer@json_abi_v3_11_3@nlohmann@@V?$vector@EV?$allocator@E@std@@@2@X@json_abi_v3_11_3@nlohmann@@AEAUtagMTFTesterResult@@@Z) 已经在 CSocketClientTester.obj 中定义 1>CSocketClientTester.obj : error LNK2005: "void __cdecl from_json(class nlohmann::json_abi_v3_11_3::basic_json<class std::map,class std::vector,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,bool,__int64,unsigned __int64,double,class std::allocator,struct nlohmann::json_abi_v3_11_3::adl_serializer,class std::vector<unsigned char,class std::allocator<unsigned char> >,void> const &,struct tagMTFTesterResultAverage &)" (?from_json@@YAXAEBV?$basic_json@Vmap@std@@Vvector@2@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@_N_J_KNVallocator@2@Uadl_serializer@json_abi_v3_11_3@nlohmann@@V?$vector@EV?$allocator@E@std@@@2@X@json_abi_v3_11_3@nlohmann@@AEAUtagMTFTesterResultAverage@@@Z) 已经在 CSocketClientTester.obj 中定义
03-21
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值