在Windows XP上編譯OpenCV

來源:互聯網
上載者:User

安裝包有:OpenCV-2.4.2.exe,cmake-2.8.9-win32-x86.exe,我用的是mingw是qtcreator-2.4.1內建的,後面的版本把mingw去掉了。

注意要把C:\Qt\qtcreator-2.4.1\mingw\bin;C:\Qt\4.8.0\bin;C:\Program Files\CMake 2.8\bin添加到環境變數中去。

(1):CMake-GUI中Check WITH_QT,然後編譯通不過

error:'class QString' has no member named 'toStdString'
這個是我裁掉了 -no-stl,重新編譯Qt庫,不知道這個選項具體有什麼意義?

(2):C:/opencv/build
添加一個變數
QT_QMAKE_EXECUTABLE   C:/Qt/4.8.0/bin/qmake.exe

點擊cmake-gui上的configure按鈕,沒有問題後再點擊generate按鈕產生makefile檔案;

cd C:\opencv\build

mingw32-make.exe

再編譯例子,例子代碼http://blog.csdn.net/zimingjushi/article/details/6713716

(3): ..\build\include/opencv2/flann/saving.h:113:
error: exception handling disabled, use -fexceptions to enable
此問題的出現是編譯器的異常異常捕獲被禁用了,
g++ -fexceptions main.cpp -o main

在example pro檔案中添加
QMAKE_CXXFLAGS += -fexceptions
QMAKE_CFLAGS += -fexceptions
還是提示此錯誤
是不是Qt 4.8.0中編譯-no-exceptions這個參數造成的?
yes,重新編譯Qt庫即可。

(4):怎麼編譯例子呢?
勾選Build_EXAMPLES

--------------
halcon
    cv —— 核心函數庫
    cvaux —— 輔助函數庫
    cxcore —— 資料結構與線性代數庫
    highgui —— GUI函數庫
    ml —— 機器學習函數庫

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.