Win10下Qt+OpenCV+Cmake編譯錯誤
Win10下Qt+OpenCV+Cmake編譯錯誤
工具:
QT5.14.2
cmake-3.19.1-win64-x64
opencv4.3.0
mingw-w64-install
安裝完Opencv、Qt和Cmake之後在cmd下通過mingw32-make編譯,結果出現錯誤,錯誤提示如下:
錯誤(一):
gcc: error: long: No such file or directory
C:\Strawberry\c\bin\windres.exe: preprocessing failed.
mingw32-make[2]: *** [modules\core\CMakeFiles\opencv_core.dir\build.make:1494: modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:1909: modules/core/CMakeFiles/opencv_core.dir/all] Error 2
mingw32-make: *** [Makefile:181: all] Error 2
原因:the windres.exe mingw uses cannot handle/escape “long long” given as a cmdline arg
解決方法:在cmake裡面找到OPENCV_ENABLE_ALLOCATOR_STATS或者在search裡面搜尋,然後把後面的勾選去掉,接著Configure和Generate後,接著在cmd視窗中mingw32-make即可繼續編譯。
錯誤(二):
D:/Qt6/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: i386 architecture of input file `CMakeFiles\opencv_core.dir/objects.a(vs_version.rc.obj)' is incompatible with i386:x86-64 output
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [modules\core\CMakeFiles\opencv_core.dir\build.make:1708: bin/libopencv_core430.dll] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:1909: modules/core/CMakeFiles/opencv_core.dir/all] Error 2
mingw32-make: *** [Makefile:181: all] Error 2
原因:相容問題
解決方法:http://mingw-w64.org/doku.php/download下載安裝mingw-w64-install,成功後接著Configure和Generate後,在cmd視窗中mingw32-make即可繼續編譯
錯誤(三):
[ 33%] Linking CXX shared library ..\..\bin\libopencv_core430.dll
D:/Qt6/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: i386 architecture of input file `CMakeFiles\opencv_core.dir/objects.a(vs_version.rc.obj)' is incompatible with i386:x86-64 output
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [modules\core\CMakeFiles\opencv_core.dir\build.make:1708: bin/libopencv_core430.dll] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:1909: modules/core/CMakeFiles/opencv_core.dir/all] Error 2
mingw32-make: *** [Makefile:181: all] Error 2
解決方法:在cmake gui中新增條目OPENCV_VS_VERSIONINFO_SKIP = 1,再重新Configure,Generate後,在cmd視窗中mingw32-make即可繼續編譯
相關文章
- 編譯錯誤,請教一下!編譯
- VS 編譯錯誤編譯
- ipvs編譯錯誤編譯
- php編譯小錯誤PHP編譯
- 編譯PHP的錯誤編譯PHP
- JNI命令列下編譯錯誤解決方案命令列編譯
- opencv 編譯常見錯誤OpenCV編譯
- 最近編譯tolua_runtime安卓編譯錯誤編譯安卓
- 經典的編譯錯誤 (轉)編譯
- PHP編譯安裝時常見錯誤解決辦法,php編譯常見錯誤PHP編譯
- IDEA報錯java: 編譯失敗: 內部 java 編譯器錯誤IdeaJava編譯
- Include檔案易犯編譯錯誤編譯
- centos下caffe用GPU編譯搭建過程以及錯誤總結CentOSGPU編譯
- Android編譯通過,執行編譯錯誤問題總結Android編譯
- Idea編譯錯誤解決辦法Idea編譯
- PHP編譯錯誤及解決辦法PHP編譯
- Android Studio 編譯錯誤集錦Android編譯
- 編譯EJB出現錯誤的解決編譯
- 請教,struts中jsp編譯錯誤JS編譯
- 編譯實體Bean出現如下錯誤.....編譯Bean
- JB7的常見編譯錯誤!!編譯
- eclipse 編譯錯誤,找不到servlet包Eclipse編譯Servlet
- win10環境下fortran怎麼編譯_win10環境下fortran如何編譯Win10編譯
- 編譯錯誤導致浪費10多分鐘, 編譯錯誤的提示:xxx does not name a type xxx編譯
- xcode6編譯錯誤,提示Expected a typeXCode編譯
- Ubuntu上的pycrypto給出了編譯器錯誤Ubuntu編譯
- 精讀《手寫 SQL 編譯器 - 錯誤提示》SQL編譯
- AndroidStudio之NDK常見編譯錯誤Android編譯
- Docker環境編譯時的錯誤記錄Docker編譯
- ndk編譯錯誤:error: 'override' does not name a type編譯ErrorIDE
- OpenCV1.0編譯錯誤解決辦法OpenCV編譯
- ios交叉比編譯android錯誤解決iOS編譯Android
- 編譯notepad++的錯誤解決編譯
- 執行無法解決的編譯錯誤編譯
- Windows 下 Laravel Mix 資源編譯過程以及產生的錯誤解決WindowsLaravel編譯
- Lombok 的@ToString導致的Maven編譯錯誤LombokMaven編譯
- xcode 編譯opencv ios容易出現的錯誤XCode編譯OpenCViOS
- 正確理解PHP程式編譯時的錯誤資訊PHP編譯