配置OpenCV遇到的問題

2021-07-13 12:04:48 字數 3527 閱讀 4268

首先,參考網上資源

的博文一步一步的配置

配置完成後,發現我的vs2010仍然不能編譯成功,出現」無法解析的外部符號」的提示錯誤

即:鏈結庫沒有配置成功

經過測試發現,我的vs2010配置的」vc++目錄->庫目錄」是無效的

但是」vc++目錄->包含目錄」是有效的

保留」vc++目錄->包含目錄」的配置,刪除其他所有配置

自定義乙個」opencv_config.h」檔案

#include "d:\\opencv-2.3.1-win-superpack\\opencv\\build\\include\\opencv2\\opencv.hpp"

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_calib3d231d.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_contrib231d.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_core231d.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_features2d231d.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_flann231d.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_gpu231d.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_highgui231d.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_imgproc231d.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_legacy231d.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_ml231d.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_objdetect231d.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_ts231d.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_video231d.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_calib3d231.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_contrib231.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_core231.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_features2d231.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_flann231.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_gpu231.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_highgui231.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_imgproc231.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_legacy231.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_ml231.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_objdetect231.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_ts231.lib")

#pragma comment(lib,"d:\\opencv-2.3.1-win-superpack\\opencv\\build\\x86\\vc10\\lib\\opencv_video231.lib")

路徑為opencv的安裝路徑

在main.h中包含這個opencv_config.h檔案,即可正常使用opencv

#include "opencv_config.h" 

using

namespace

std;

int main()

OPENCV在QT上配置遇到的沙雕問題

修改pro檔案時,注意libs新增是要把bin資料夾下的所有lib檔案都新增,此外路徑前 l 和庫檔名前的 l 別刪了。改完後記得儲存,不然後面編寫包含標頭檔案時,搜尋不到相應的標頭檔案。includepath d qt qt opencv3.2 contrub include opencv2 d ...

OpenCV 遇到的常見問題

1.怎麼檢視opencv的版本呢 pkg config modversion opencv我是通過apt get安裝的,已經是編譯好的opencv,查出來的版本號是2.4.8 2.ubuntu 安裝opencv nonfree模組 sudo apt get update sudo add apt r...

OpenCV遇到的問題(持續更新)

1.未經處理的異常 0x00007ffa95d9a388 處 位於 image pro1.exe 中 有未經處理的異常 microsoft c 異常 cv exception,位於記憶體位置 0x000000bd2c8ef520 處。如圖 解決方法 原因一 imread中檔案的路徑,和.cpp檔案或...