MingW Cmake bulid OpenCV

MingW需要安裝,可以隨codeblocks安裝,但是需要注意安裝位置。
cmake需要知道mingw的安裝位置,而cmake是通過系統變量知道的,系統變量是操作系統管理的,所以首先綠色版的mingw肯定是不行的,除非手動增加系統變量,win8情況下mingw隨codeblocks安裝在program files下沒有問題,但是win10經測不行,報如下錯誤

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.

參考此貼

最後把我整個解決方法說下:首先看看Mingw的官方文檔的說明:we strongly recommend that you do not install MinGW in any location with spaces in the path name reference. You should avoid installing into any directory or subdirectory having names like “Program Files” or “My Documents”, etc.
The preferred installation target directory is C:\MinGW
我的mingw的安裝目錄開始是在d:\Program Files下,上面官方文檔說的很清楚,要避免安裝在這樣的目錄下(已用紅色標出),我將mingw裝在C:\MinGW下後就可以用camke編譯了,當然中途也出現過一些錯誤,那都是與版本有關,最後我參照CSDN的一個帖子用的opencv2.4.9 cmake2.8.12成功編譯

以上辦法仍然無效,需要手動添加mingw的bin文件夾路徑到系統環境變量path

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章