Results 1 to 3 of 3

Thread: Qt and OpenCV

  1. #1
    Join Date
    Nov 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Qt and OpenCV

    Hi ! I know there are other threads about "Qt and OpenCV" but I didn't find any understable solution for my problem. Sorry if my search was not well done.

    Here is my problem: I try to use someone else's code to create an UI (now it is just a console application). I never tried to run this code on my computer, I am not sure there is no problem but there wasn't problem on other computers, it was running well. The problem is that code uses some OpenCV functions, it uses:

    #include <cv.h>
    #include <highgui.h>

    I tried to follow some advices and to search on this forum.

    Until now, I wrote in my .pro file:
    Qt Code:
    1. QT -= gui
    2. TARGET = testSeb
    3. CONFIG += console
    4. CONFIG -= app_bundle
    5. TEMPLATE = app
    6. SOURCES += main.cpp \
    7. FichiersSources/SignatureImage.cpp \
    8. FichiersSources/Repertoire.cpp \
    9. FichiersSources/Librairie.cpp \
    10. FichiersSources/FichierImage.cpp \
    11. FichiersSources/Fichier.cpp \
    12. FichiersSources/Description.cpp \
    13. FichiersSources/BaseDImages.cpp
    14. HEADERS += FichiersRessources/dirent.h \
    15. FichiersDEntete/SignatureImage.h \
    16. FichiersDEntete/Repertoire.h \
    17. FichiersDEntete/Librairie.h \
    18. FichiersDEntete/FichierImage.h \
    19. FichiersDEntete/Fichier.h \
    20. FichiersDEntete/Description.h \
    21. FichiersDEntete/BaseDImages.h
    22. INCLUDEPATH += "C:\OpenCV2.0\include\opencv"
    23. LIBS += "C:\OpenCV2.0\lib\libcv200.dll.a" "C:\OpenCV2.0\lib\libcvaux200.dll.a" "C:\OpenCV2.0\lib\libcxcore200.dll.a" "C:\OpenCV2.0\lib\libhighgui200.dll.a" "C:\OpenCV2.0\lib\libcxts200.dll.a"
    To copy to clipboard, switch view to plain text mode 

    "C:\OpenCV2.0\include\opencv" is the repertory where cv.h and highgui.h are.

    But I obtained 17 errors and 45 warnings when compiling:

    Qt Code:
    1. "Running build steps for project testSeb...
    2. Starting: C:/Qt/2009.04/qt/bin/qmake.exe C:/Documents and Settings/Malorie/qtprojects/testSeb/testSeb.pro -spec win32-g++ -r
    3. Exited with code 0.
    4. Starting: C:/Qt/2009.04/mingw/bin/mingw32-make.exe -w
    5. mingw32-make: Entering directory `C:/Documents and Settings/Malorie/qtprojects/testSeb'
    6. C:/Qt/2009.04/mingw/bin/mingw32-make -f Makefile.Debug
    7. mingw32-make[1]: Entering directory `C:/Documents and Settings/Malorie/qtprojects/testSeb'
    8. g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\Qt\2009.04\qt\include\QtCore" -I"..\..\..\..\Qt\2009.04\qt\include" -I"..\..\..\..\OpenCV2.0\include\opencv" -I"..\..\..\..\Qt\2009.04\qt\include\ActiveQt" -I"debug" -I"..\..\..\..\Qt\2009.04\qt\mkspecs\win32-g++" -o debug\main.o main.cpp
    9. In file included from ../../../../OpenCV2.0/include/opencv/cxcore.hpp:2243,
    10. from ../../../../OpenCV2.0/include/opencv/cxcore.h:2123,
    11. from ../../../../OpenCV2.0/include/opencv/cv.h:58,
    12. from FichiersDEntete/Librairie.h:12,
    13. from FichiersDEntete/Repertoire.h:10,
    14. from FichiersDEntete/Fichier.h:10,
    15. from FichiersDEntete/FichierImage.h:10,
    16. from main.cpp:11:
    17. ../../../../OpenCV2.0/include/opencv/cxoperations.hpp: In member function `void cv:Ptr<_Tp>::addref()':
    18. ../../../../OpenCV2.0/include/opencv/cxoperations.hpp:1442: error: there are no arguments to `__exchange_and_add' that depend on a template parameter, so a declaration of `__exchange_and_add' must be available
    19. ../../../../OpenCV2.0/include/opencv/cxoperations.hpp:1442: error: (if you use `-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
    20. ../../../../OpenCV2.0/include/opencv/cxoperations.hpp: In member function `void cv:Ptr<_Tp>::release()':
    21. ../../../../OpenCV2.0/include/opencv/cxoperations.hpp:1446: error: there are no arguments to `__exchange_and_add' that depend on a template parameter, so a declaration of `__exchange_and_add' must be available
    22. (...My message is too long...)
    23. mingw32-make[1]: *** [debug/main.o] Error 1
    24. mingw32-make: *** [debug] Error 2
    25. Exited with code 2.
    26. Error while building project testSeb
    27. When executing build step 'Make'
    To copy to clipboard, switch view to plain text mode 
    I did not paste all the message because it was too long. Please tell me how to post it if it is necessary.

    I must say I don't understand at all... I am just a beginner, so it is quite difficult for me, sorry if my question is ridiculous...

    Thank you in advance for your answers !

    (I am sorry, I know my English is not good, but French is my mother tongue)

  2. #2
    Join Date
    Nov 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt and OpenCV

    (Sorry, I do not find how to edit my thread).

    In fact, my problem is solved ! I was using OpenCV 2.0 while the code was for version 1.0. Now everything is working well. There was no error in my project file, it was correct to do:

    Qt Code:
    1. INCLUDEPATH += "D:\Program Files\OpenCV\cv\include" "D:\Program Files\OpenCV\cvaux\include" "D:\Program Files\OpenCV\cxcore\include" "D:\Program Files\OpenCV\otherlibs\highgui"
    2. LIBS += -L"D:\Program Files\OpenCV\lib" -lcv -lcvaux -lhighgui -lcxcore
    3.  
    4. # Input
    5. HEADERS += "D:\Program Files\OpenCV\cv\include\cv.h" "D:\Program Files\OpenCV\otherlibs\highgui\highgui.h"
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Apr 2008
    Posts
    35
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt and OpenCV

    Quote Originally Posted by malorie View Post
    Hi ! I know there are other threads about "Qt and OpenCV" but I didn't find any understable solution for my problem. Sorry if my search was not well done.

    Here is my problem: I try to use someone else's code to create an UI (now it is just a console application). I never tried to run this code on my computer, I am not sure there is no problem but there wasn't problem on other computers, it was running well. The problem is that code uses some OpenCV functions, it uses:

    #include <cv.h>
    #include <highgui.h>

    I tried to follow some advices and to search on this forum.

    Until now, I wrote in my .pro file:
    Qt Code:
    1. QT -= gui
    2. TARGET = testSeb
    3. CONFIG += console
    4. CONFIG -= app_bundle
    5. TEMPLATE = app
    6. SOURCES += main.cpp \
    7. FichiersSources/SignatureImage.cpp \
    8. FichiersSources/Repertoire.cpp \
    9. FichiersSources/Librairie.cpp \
    10. FichiersSources/FichierImage.cpp \
    11. FichiersSources/Fichier.cpp \
    12. FichiersSources/Description.cpp \
    13. FichiersSources/BaseDImages.cpp
    14. HEADERS += FichiersRessources/dirent.h \
    15. FichiersDEntete/SignatureImage.h \
    16. FichiersDEntete/Repertoire.h \
    17. FichiersDEntete/Librairie.h \
    18. FichiersDEntete/FichierImage.h \
    19. FichiersDEntete/Fichier.h \
    20. FichiersDEntete/Description.h \
    21. FichiersDEntete/BaseDImages.h
    22. INCLUDEPATH += "C:\OpenCV2.0\include\opencv"
    23. LIBS += "C:\OpenCV2.0\lib\libcv200.dll.a" "C:\OpenCV2.0\lib\libcvaux200.dll.a" "C:\OpenCV2.0\lib\libcxcore200.dll.a" "C:\OpenCV2.0\lib\libhighgui200.dll.a" "C:\OpenCV2.0\lib\libcxts200.dll.a"
    To copy to clipboard, switch view to plain text mode 

    "C:\OpenCV2.0\include\opencv" is the repertory where cv.h and highgui.h are.

    But I obtained 17 errors and 45 warnings when compiling:

    Qt Code:
    1. "Running build steps for project testSeb...
    2. Starting: C:/Qt/2009.04/qt/bin/qmake.exe C:/Documents and Settings/Malorie/qtprojects/testSeb/testSeb.pro -spec win32-g++ -r
    3. Exited with code 0.
    4. Starting: C:/Qt/2009.04/mingw/bin/mingw32-make.exe -w
    5. mingw32-make: Entering directory `C:/Documents and Settings/Malorie/qtprojects/testSeb'
    6. C:/Qt/2009.04/mingw/bin/mingw32-make -f Makefile.Debug
    7. mingw32-make[1]: Entering directory `C:/Documents and Settings/Malorie/qtprojects/testSeb'
    8. g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\Qt\2009.04\qt\include\QtCore" -I"..\..\..\..\Qt\2009.04\qt\include" -I"..\..\..\..\OpenCV2.0\include\opencv" -I"..\..\..\..\Qt\2009.04\qt\include\ActiveQt" -I"debug" -I"..\..\..\..\Qt\2009.04\qt\mkspecs\win32-g++" -o debug\main.o main.cpp
    9. In file included from ../../../../OpenCV2.0/include/opencv/cxcore.hpp:2243,
    10. from ../../../../OpenCV2.0/include/opencv/cxcore.h:2123,
    11. from ../../../../OpenCV2.0/include/opencv/cv.h:58,
    12. from FichiersDEntete/Librairie.h:12,
    13. from FichiersDEntete/Repertoire.h:10,
    14. from FichiersDEntete/Fichier.h:10,
    15. from FichiersDEntete/FichierImage.h:10,
    16. from main.cpp:11:
    17. ../../../../OpenCV2.0/include/opencv/cxoperations.hpp: In member function `void cv:Ptr<_Tp>::addref()':
    18. ../../../../OpenCV2.0/include/opencv/cxoperations.hpp:1442: error: there are no arguments to `__exchange_and_add' that depend on a template parameter, so a declaration of `__exchange_and_add' must be available
    19. ../../../../OpenCV2.0/include/opencv/cxoperations.hpp:1442: error: (if you use `-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
    20. ../../../../OpenCV2.0/include/opencv/cxoperations.hpp: In member function `void cv:Ptr<_Tp>::release()':
    21. ../../../../OpenCV2.0/include/opencv/cxoperations.hpp:1446: error: there are no arguments to `__exchange_and_add' that depend on a template parameter, so a declaration of `__exchange_and_add' must be available
    22. (...My message is too long...)
    23. mingw32-make[1]: *** [debug/main.o] Error 1
    24. mingw32-make: *** [debug] Error 2
    25. Exited with code 2.
    26. Error while building project testSeb
    27. When executing build step 'Make'
    To copy to clipboard, switch view to plain text mode 
    I did not paste all the message because it was too long. Please tell me how to post it if it is necessary.

    I must say I don't understand at all... I am just a beginner, so it is quite difficult for me, sorry if my question is ridiculous...

    Thank you in advance for your answers !

    (I am sorry, I know my English is not good, but French is my mother tongue)
    This error is because you are using mingw gcc version less than 4.
    you can check the version by going to qt command prompt and typing

    g++ --version

    if version less than 4 , install the latest gcc/g++ 4.x.x for mingw.

    and also try changing line 68 in cxoperations.hpp from
    #if __GNUC__ >= 4
    to
    #if __GNUC__ >= 4 || __MINGW32__

Similar Threads

  1. OpenCV integration
    By sfabel in forum Qt Programming
    Replies: 47
    Last Post: 28th January 2013, 05:19
  2. Replies: 8
    Last Post: 18th March 2011, 11:27
  3. Beginner Qt and OpenCV
    By tiho_bg in forum Qt Programming
    Replies: 1
    Last Post: 9th November 2009, 11:39
  4. OpenCv & Qt4
    By switch in forum Qt Programming
    Replies: 0
    Last Post: 4th August 2009, 15:12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.