error LNK2019: 无法解析的外部符号 "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl cv::xfeatures2d::VGG::getDefaultName(void)const " (?getDefaultName@VGG@xfeatures2d@cv@@UEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ),该符号在函数 "[thunk]:public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl cv::xfeatures2d::VGG::getDefaultName`vtordisp{4294967292,0}' (void)const " (?getDefaultName@VGG@xfeatures2d@cv@@$4PPPPPPPM@A@EBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) 中被引用
22>D:\VSProjects\opencv\build\bin\Release\opencv_xfeatures2d4120.dll : fatal error LNK1120: 1 个无法解析的外部命令

今天编译opencv的时候遇到这个问题,记录一下解决方案,大家要是遇到相同的问题可以借鉴下。
1、查看build路径下的CMakeDownloadLog.txt
2、看到缺少vgg_generated_xx.i 和boostdesc_bgm.i等文件
3、去opencv_3rdparty下载对应的文件,并放至自己指定的build路径下的downloads\xfeatures2d中,如D:/opencv/build/downloads\xfeatures2d\,然后重新配置,生成,编译即可

Logo

中国智能体开发者社区,聚焦智能体与大模型开发,提供前沿资讯、实用工具链、开源项目及行业案例。通过技术沙龙、开发者大赛等活动,促进经验交流与协作,助力开发者快速构建创新智能应用。

更多推荐