Results 1 to 12 of 12

Thread: undefined reference to `cvCreateCameraCapture'

  1. #1
    Join Date
    Feb 2010
    Posts
    12
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default undefined reference to `cvCreateCameraCapture'

    hi, i am new at qt, i installed opencv, and i want to make i simple example like capturing a frame from webcam. i wrote the first line but it gave error. so i cant continue.

    codes in my main class is :
    #include <QtGui/QApplication>
    #include "mainwindow.h"
    #include "opencv/cv.h"
    #include "opencv/highgui.h"
    #include "opencv/cxcore.h"

    CvCapture* myCap;
    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    myCap = cvCaptureFromCAM(0);
    return a.exec();
    }

    it gives everytime same error what should i do ?
    "undefined reference to `cvCreateCameraCapture'"

  2. #2
    Join Date
    Mar 2008
    Location
    Houston, Texas, USA
    Posts
    277
    Thanks
    9
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default Re: undefined reference to `cvCreateCameraCapture'

    You need to link to the OpenCV libraries.
    Qt-4.7.3 | Gentoo ~amd64 | KDE-4.7
    Aki IRC Client for KDE4 | Qt Documentation

  3. #3
    Join Date
    Feb 2010
    Posts
    12
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: undefined reference to `cvCreateCameraCapture'

    hmm thanks, how can i do it ?

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: undefined reference to `cvCreateCameraCapture'

    Use your pro file! Something like that (found through simple google-ing):
    qmake Code:
    1. INCLUDEPATH += "C:\Program Files\OpenCV\cxcore\include" \
    2. "C:\Program Files\OpenCV\cv\include" \
    3. "C:\Program Files\OpenCV\cvaux\include" \
    4. "C:\Program Files\OpenCV\otherlibs\highgui" \
    5. "C:\Program Files\OpenCV\cxcore\include"
    6. win32:LIBS += -L"C:\Program Files\OpenCV\lib"
    7. LIBS += -lcv \
    8. -lcvaux \
    9. -lhighgui \
    10. -lcxcore
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Feb 2010
    Posts
    12
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: undefined reference to `cvCreateCameraCapture'

    thanx my friend, is it possible to be made automaticly ?

  6. #6
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: undefined reference to `cvCreateCameraCapture'

    ? Don't understand you. What should be automatic?

  7. #7
    Join Date
    Feb 2010
    Posts
    12
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: undefined reference to `cvCreateCameraCapture'

    can Qt add this parameters automaticly or every project we have to declare them manually ?

  8. #8
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: undefined reference to `cvCreateCameraCapture'

    No, you have to add these lines one time at the pro file for every project you start. There is no automatic way to do it.
    And I don't know your definition of "work" but this takes only 2 seconds and if you don't start a new project every 5 seconds, It's no big deal.

  9. #9
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: undefined reference to `cvCreateCameraCapture'

    you should add new libs manually in pro-file.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  10. #10
    Join Date
    Feb 2010
    Posts
    12
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: undefined reference to `cvCreateCameraCapture'

    thanks i see no problem any more

  11. #11
    Join Date
    Jul 2012
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: undefined reference to `cvCreateCameraCapture'

    Am using linux and i have downloaded Opencv2.2.0 and i have same problem i cannot see the lib folder in my opencv please any assistance
    Quote Originally Posted by Lykurg View Post
    Use your pro file! Something like that (found through simple google-ing):
    qmake Code:
    1. INCLUDEPATH += "C:\Program Files\OpenCV\cxcore\include" \
    2. "C:\Program Files\OpenCV\cv\include" \
    3. "C:\Program Files\OpenCV\cvaux\include" \
    4. "C:\Program Files\OpenCV\otherlibs\highgui" \
    5. "C:\Program Files\OpenCV\cxcore\include"
    6. win32:LIBS += -L"C:\Program Files\OpenCV\lib"
    7. LIBS += -lcv \
    8. -lcvaux \
    9. -lhighgui \
    10. -lcxcore
    To copy to clipboard, switch view to plain text mode 

  12. #12
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: undefined reference to `cvCreateCameraCapture'

    Did you build it (sources) or you downloaded already built version (binaries)?
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

Similar Threads

  1. undefined reference
    By jayreddy in forum Qt Programming
    Replies: 1
    Last Post: 20th November 2009, 13:45
  2. template, undefined reference to fnc
    By Lodhart in forum Newbie
    Replies: 1
    Last Post: 26th October 2009, 17:11
  3. Undefined reference to crt
    By derektaprell in forum Installation and Deployment
    Replies: 0
    Last Post: 20th October 2009, 08:34
  4. Undefined Reference To...
    By ManuMies in forum Qt Programming
    Replies: 6
    Last Post: 10th February 2009, 12:14
  5. Undefined reference
    By Salazaar in forum Newbie
    Replies: 12
    Last Post: 23rd May 2007, 10:21

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.