gpt4 book ai didi

opencv - 错误 LNK2019 : unsolvable external symbol (OpenCV + VS2012)

转载 作者:行者123 更新时间:2023-12-02 16:40:55 28 4
gpt4 key购买 nike

我搜索了很多,但没有一个答案有帮助。

我在下面添加了这些东西:

include directory: D:\Program Files (x86)\opencv\build\include
library directory: D:\Program Files (x86)\opencv\build\x86\vc11\lib
additional library directory: D:\Program Files (x86)\opencv\build\x86\vc11\lib
additional dependency: %(AdditionalDependencies);opencv_core248d.lib;opencv_imgproc248d.lib;opencv_ml248d.lib;opencv_video248d.lib;opencv_features2d248d.lib;opencv_calib3d248d.lib;opencv_objdetect248d.lib;opencv_contrib248d.lib;opencv_legacy248d.lib;opencv_flann248d.lib;

我使用的是 64 位机器,但是添加 x64 目录会造成很多麻烦,所以我添加了 x86 目录。

我使用了下面的测试代码:
#include "opencv2/opencv.hpp"

using namespace cv;
int main()
{
Mat img = imread("../opencv.jpg");

if (img.empty())
{
fprintf(stderr, "Error: load image failed.");
return -1;
}
namedWindow("image", CV_WINDOW_AUTOSIZE);
imshow("image", img);
waitKey();

return 0;
}

问题是:(忽略中文部分)
1>test.obj : error LNK2019: unsolvable external symbol "void __cdecl cv::namedWindow(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" (?namedWindow@cv@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z),该符号在函数 _main 中被引用
1>test.obj : error LNK2019: unsolvable external symbol "int __cdecl cv::waitKey(int)" (?waitKey@cv@@YAHH@Z),该符号在函数 _main 中被引用
1>test.obj : error LNK2019: unsolvable external symbol "void __cdecl cv::imshow(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class cv::_InputArray const &)" (?imshow@cv@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV_InputArray@1@@Z),该符号在函数 _main 中被引用
1>test.obj : error LNK2019: unsolvable external symbol "class cv::Mat __cdecl cv::imread(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" (?imread@cv@@YA?AVMat@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z),该符号在函数 _main 中被引用

先感谢您!!

最佳答案

请引用 this question 的回答.这可能是由于混合了 64/32 位库和应用程序造成的。

This instruction详细展示了如何使用 VS 构建 opencv 应用程序。希望它会有所帮助。

关于opencv - 错误 LNK2019 : unsolvable external symbol (OpenCV + VS2012),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22395662/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com