Important: Please read the Qt Code of Conduct -

Unable to compile Qt+visualGDB+openCV

  • I am new to Qt. I am trying to develop a camera application using openCV on my embedded board running Debian Stretch '9'. I have the application running well on vs2019 (win10) but when I tried to run the same application using 'vs2019+visualGDB' cross compilation, it gives me error of "undefined reference to symbol....." and cv::VideoCapture::VideoCapture()'

    I am not sure whether I should edit .pro file or something else, please suggest.

  • Lifetime Qt Champion

    But did you compile openVC so the visualGDB cross-compiler helper can find it ?

    When running on Win 10, it uses the win 10 Dlls for OpenCV. Most likely some you downloaded?

    To run it the Debian, you need openVC for linux also.

    But do you ONLY get one undefined symbol message or Tons of them ?

  • @mrjj yes there are tons of similar messages like "undefined reference'
    Please let me know how I can configure it so that 'visualGDB cross-compiler can find it?

  • Lifetime Qt Champion

    @Ashh said in Unable to compile Qt+visualGDB+openCV:

    @mrjj yes there are tons of similar messages like "undefined reference'

    Ok then it sounds like it is what i think and not just one function it cant find.

    Please let me know how I can configure it so that 'visualGDB cross-compiler can find it?

    Im afraid I have no idea how to set it up as I never used visualGDB.
    Maybe you can ask them?

    Here its for a pi board.
    it has link to

    That talks about what is needed.

    However, one can already get precompiled openCV for Debian Stretch so maybe there is an easier way then to compile it your self.

  • @mrjj Thanks.
    sorry but in this Do I need to create 2 different projects for 'opencv' and 'main application'. since I can generate the base code for Qt application using visualGDB since it supports like... Qmake instead of CMake


    with project templates:
    -Qt5-based application (Deprecated Qmake)
    -Qt5-based application (CMake)
    -Qt4-based application (Deprecated Qmake)

  • Lifetime Qt Champion

    Normally one would build it as seperate project for a given platform.
    It can be usd as shared. SO/DLL or as static lib.

    That is why i think its better to ask the visualGDB vendor as its not clear to me if
    we need to build it locally for it to work or we can somehow make it some preloaded.

    The thing is that for Pi it makes sense to compile it as we need an ARM
    version of openCv but your board is using a
    normal linux - non arm, right so we can easy apt-get isntall openCV there so
    I wonder if you get true LINKER errors or it cant find the includes are some are also undefined
    symbols in the compile phase.

    But I dont know how visualGDB does the magic so nto sure what is the correct way in your case.

  • @mrjj Thanks for your well explanation. :)
    FYI: my board is beaglebone, seems not much differ from Pi.

  • Lifetime Qt Champion

    Np :)


    Oh yes. well, then the PI tut should work.
    It is indeed very much the same. Also an arm etc.

    Can you already cross compile a non OpenCV Qt app and run it on the board?

    I would start with that before trying with openCV. just to know the Qt part does work.

  • @mrjj yes, i have tested non opencv Qt app on BB through visualGDB, it works. but when added up openCV, it gives errors related to cv::, not sure what I am missing to include....

  • @mrjj Is it something, I need to add files to *.pro? please suggest~
    I followed this and tested on BB through visualGDB, workd well. but still I didnt understand to resolve the errors related to cv::VideoCapture::VideoCapture()'....

  • Lifetime Qt Champion

    So it did work following the tut for the PI even its other board ?

    But then when trying the same with your project you get lots of liner errors still ?

    Yes to use SO files one does add stuff to the project file but if you also use Cmake, it should be just as with the tut.

  • @mrjj yes OpenCV2Demo works on BB through visualGDB considering these configs....

    Debug settings---> Executable arguments---> /home/debian/Downloads/Lena.png (as suggested in post)
    Uncheck 'custom working directory' (as suggested in post)

    After save and run, it notify for this message... (I check 'Yes')


    After save and run, it notify for this message... (I check 'No')
    I get the Lena.png as display (good!)

    Also, when I direct run ./OpenCV2Demo directly on BB, it gives me error as....

    Please suggest~ Thanks.

Log in to reply