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即可繼續編譯
相關文章
- ipvs編譯錯誤編譯
- opencv 編譯常見錯誤OpenCV編譯
- IDEA報錯java: 編譯失敗: 內部 java 編譯器錯誤IdeaJava編譯
- PHP編譯安裝時常見錯誤解決辦法,php編譯常見錯誤PHP編譯
- path_provider 編譯錯誤指導IDE編譯
- Include檔案易犯編譯錯誤編譯
- Idea編譯錯誤解決辦法Idea編譯
- AndroidStudio之NDK常見編譯錯誤Android編譯
- Android編譯通過,執行編譯錯誤問題總結Android編譯
- centos下caffe用GPU編譯搭建過程以及錯誤總結CentOSGPU編譯
- xcode6編譯錯誤,提示Expected a typeXCode編譯
- PHP編譯configure時常見錯誤,和PHP7.1.4 編譯安裝PHP編譯
- flutter庫【path_provider】編譯錯誤指導FlutterIDE編譯
- Lombok 的@ToString導致的Maven編譯錯誤LombokMaven編譯
- Ubuntu上的pycrypto給出了編譯器錯誤Ubuntu編譯
- Docker環境編譯時的錯誤記錄Docker編譯
- 精讀《手寫 SQL 編譯器 - 錯誤提示》SQL編譯
- win10環境下fortran怎麼編譯_win10環境下fortran如何編譯Win10編譯
- C++編譯錯誤的正確查詢方式C++編譯
- 求助,.NET反編譯有兩萬多個錯誤編譯
- [求教] jmeter5.3 原始碼編譯報 autostyleKotlinCheck 錯誤JMeter原始碼編譯Kotlin
- 升級Xcode10導致的編譯錯誤XCode編譯
- Windows 下 Laravel Mix 資源編譯過程以及產生的錯誤解決WindowsLaravel編譯
- C語言程式碼區錯誤以及編譯過程C語言編譯
- Latex編譯錯誤:Unable to load picture or PDF file 問題解決編譯
- stm8系列--載入別人的工程編譯錯誤編譯
- Android將Jar放入libs目錄下編譯報錯AndroidJAR編譯
- win10 64位系統下openssl編譯Win10編譯
- 解決 Angular 官網下載的庫 Schematics 執行 npm run build 時遇到的編譯錯誤AngularNPMUI編譯
- QT中文編譯出錯QT編譯
- 專案編譯報錯編譯
- vs2013編譯驅動錯誤-Inf2Cat,signability test failed編譯AI
- Windows下編譯TriangleWindows編譯
- LINUX下編譯TriangleLinux編譯
- Windows下編譯OpenOCDWindows編譯
- [譯]Flask教程–重定向與錯誤Flask
- [譯] 修改 Git 錯誤的高明方法Git
- [譯] 使用 Catcher 處理 Flutter 錯誤Flutter