我試圖在visual studio + opencv中編譯一個簡單的代碼,但得到了這個錯誤。OpenCV錯誤:「LINK:致命錯誤LNK1104:無法打開文件'opencv_core231d.lib'」
代碼:
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
int main (int argc, char **argv)
{
Mat im_gray;
Mat img_bw;
Mat img_final;
Mat im_rgb = imread("001.jpg");
cvtColor(im_rgb,im_gray,CV_RGB2GRAY);
adaptiveThreshold(im_gray, img_bw, 255, ADAPTIVE_THRESH_MEAN_C, THRESH_BINARY_INV, 105, 1);
imwrite("001-bw2.jpg", img_final);
return 0;
}
輸出:
1>------ Build started: Project: pibiti, Configuration: Debug Win32 ------
1>LINK : fatal error LNK1104: cannot open file 'opencv_core231d.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
鏈接器>>輸入:
opencv_core231d.lib
opencv_highgui231d.lib
opencv_video231d.lib
opencv_ml231d.lib
opencv_legacy231d.lib
opencv_imgproc231d.lib
tbb_debug.lib
tbb_preview_debug.lib
tbbmalloc_debug.lib
tbbmalloc_proxy_debug.lib
tbbproxy_debug.lib
我該如何解決這個問題?文件'opencv_core231d.lib'已經存在,爲什麼會出現這個錯誤?
'lib'確實存在於磁盤上嗎?項目屬性中列出的文件夾是否位於* Linker-> General-> Additional庫目錄*下? –
請使用CMake生成你的項目文件。它將確保所有屬性都已配置。 – scap3y