Results 1 to 5 of 5

Thread: How to compile openCV with qmake

  1. #1
    Join Date
    Jul 2012
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to compile openCV with qmake

    Hello. I've got quite strange problem - when I include <cv.h>, i'm getting a LOT of errors in opencv files like:

    Qt Code:
    1. /usr/include/opencv2/core/types_c.h:1836:24: error: expected ‘;’ at end of member declaration
    2. /usr/include/opencv2/core/types_c.h:1836:24: error: expected unqualified-id before ‘<<’ token
    3. In file included from /usr/include/opencv/cv.h:63:0,
    4. from ../Eyes/camera.hxx:7,
    5. from ../Eyes/core.cpp:36:
    6. /usr/include/opencv2/core/core_c.h:1670:47: error: expected ‘,’ or ‘...’ before ‘<<’ token
    7. /usr/include/opencv2/core/core_c.h:1865:19: error: expected ‘;’ at end of member declaration
    8. /usr/include/opencv2/core/core_c.h:1865:19: error: expected unqualified-id before ‘<<’ token
    To copy to clipboard, switch view to plain text mode 

    and many others (172 errors)
    when I'm compiling this code out of qtcreator with command

    g++ `pkg-config opencv --cflags --libs` objectivetest.cpp -o test

    Everything is alright, but I don't have to add any code to get theese errors - just including <cv.h> cause them. I've added this to eyes.pro file:

    INCLUDEPATH += \
    $$system(./scripts/libcfg --cflags opencv)

    LIBS += \
    $$system(./scripts/libcfg --libs opencv)

    And both - highgui and cv are getting errors during compilation.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to compile openCV with qmake

    Why don't you just use pkg-config capabilities built into qmake?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jul 2012
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to compile openCV with qmake

    It hasn't helped. Errors are exactly the same. I've also tried add all paths manually, but these errors are still the same.
    I've moved include to main file and now I'm getting error:

    /usr/include/opencv2/flann/lsh_table.h:196:14: error: ‘use_speed_’ was not declared in this scope

    I don't know if it's earlier error or later and I have completely no idea why changing including place changed anything.
    Last edited by Lapsio; 15th July 2012 at 11:58.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to compile openCV with qmake

    The errors are not related to pkg-config. You need to find out what the first error is and what line it is triggered on. It might help if you change the order of includes or specify some define before including the file. Many people successfully use OpenCV with Qt so what you experience has to be related to your specific configuration.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jul 2012
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to compile openCV with qmake

    These errors were caused by using defines of oerror and some other defines which are used by OpenCV. Sorry for trouble, I should revise my code before ask.

Similar Threads

  1. Trying to use OpenCV
    By danilodsp in forum Newbie
    Replies: 6
    Last Post: 18th August 2011, 08:41
  2. opencv-qt-mac
    By ireneluis in forum Qt Programming
    Replies: 0
    Last Post: 16th March 2010, 15:24
  3. Qt and OpenCV
    By malorie in forum Newbie
    Replies: 2
    Last Post: 7th March 2010, 14:57
  4. OpenCv & Qt4
    By switch in forum Qt Programming
    Replies: 0
    Last Post: 4th August 2009, 15:12
  5. OpenCv + Qt
    By Janderson Borges in forum Qt Programming
    Replies: 3
    Last Post: 2nd December 2008, 13:01

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.