Problem compiling example code

Help
Anonymous
2010-12-02
2013-05-09

  • Anonymous
    2010-12-02

    Hi there,

    I'm new to ivt and starting to learn about it by diving into the examples…

    I managed to compile the ivt.lib and ivtd.lib as well as the ivtguiqt.lib and ivtguiqt.lib. I'm using Code::Blocks 10.05 (with the includen MinGW 4.4.1) and QT 4.7.1. So I guess my development environment should be alright. Also because I can compile and use the SimpleApp without any problem.

    Now I would like to compile the KLTTrackerDemo code and I run into this errors:

    ||=== KLTTrackerDemo, Win32 Debug ===|
    Debug\examples\KLTTrackerDemo\main.o:D:\__IVT\IVT\examples\KLTTrackerDemo\main.cpp|127|undefined reference to `CreateApplicationHandler(int, char**)'|
    Debug\examples\KLTTrackerDemo\main.o:D:\__IVT\IVT\examples\KLTTrackerDemo\main.cpp|131|undefined reference to `CreateMainWindow(int, int, int, int, char const*)'|
    ||=== Build finished: 2 errors, 0 warnings ===|

    Actually I do not know where to look to find the problem. I guess it has to do something with the fact that I would like to use QT as GUI framework instead of the MS Windows stuff. (I guess I have to if I do not want to use Visual Studio…)

    I really would appreciate any help!

    Thanks, regards,
    Max

     
  • Pedram Azad
    Pedram Azad
    2010-12-03

    Hi Max,

    haven't thought of this combination yet - under Windows per default the Win32 API of the IVT GUI toolkit is used. But you should be able to activate the Qt implementation this way:

    Remove all files from the ivtguiqt.lib/ivtguiqtd.lib project (those files are old and not part of the new GUI toolkit) and add the following files:

    IVT/src/gui/GUIFactory.*
    IVT/src/gui/Qt/*

    Also set in the preprocessor settings of this project the defines USE_QT4 (or USE_QT3, depending on your installation) and USE_QTGUI.

    The files IVT/src/gui/Qt/QtApplicationHandler.h and gui/Qt/QtMainWindowWidget.h need moc. You can integrate this the same way this is done e.g. for the olde file IVT/src/gui/QTApplicationHandler.h.

    Let me know if this worked.

    Regards,
    Pedram

     

  • Anonymous
    2010-12-04

    Hi Pedram,

    First of all thanks for your fast reply!

    I managed to adapt the ivtguiqt.lib-project. I removed the 'old' files, added the 'new' files and changed the prepocessor settings. So far so good. Compiling works fine too. (I just had to add 'qt/' several times to some includes (where qt-libs were included) within the code.

    You also told me to add moc (?). As I do not understand what you mean by 'moc' and I don't know how to integrate it as well. I had a look at the 'old' file IVT/src/gui/QTApplicationHandler.h as you said too, but that did not clear up anything as I cannot find any reference to moc in that file…

    Maybe you can help me out one more time? Thanks!

    Anyway, as I have newly compiled ivtguiqt libs (ivtguiqt.lib and ivtguiqtd.lib) available, I gave comiling KLTrackerDemo once again. Unfortunately it did not work either… most likely because of the missing 'moc' stuff… see the errors I get below:

    --------- Build: Win32 Debug in KLTTrackerDemo ----------

    mingw32-g++.exe -DUSE_QT4 -DUSE_QTGUI  -g -W -fexceptions -DWIN32 -D_DEBUG -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE    -I..\..\src  -c D:\__IVT\IVT\examples\KLTTrackerDemo\main.cpp -o Debug\examples\KLTTrackerDemo\main.o
    mingw32-g++.exe -L..\..\lib\win32  -o KLTTrackerDemod.exe Debug\examples\KLTTrackerDemo\main.o    -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -livtd -livtguiqtd -lcomctl32 -lopengl32 -lglu32 -lvfw32 
    ..\..\lib\win32/ivtguiqtd.lib(GUIFactory.o): In function `Z10FileDialogbPPKciS0_Pci':
    D:/__IVT/IVT/src/gui/GUIFactory.cpp:86: undefined reference to `_imp___ZN12QApplicationC1ERiPPci'
    D:/__IVT/IVT/src/gui/GUIFactory.cpp:111: undefined reference to `_imp___ZN11QFileDialog15getSaveFileNameEP7QWidgetRK7QStringS4_S4_PS2_6QFlagsINS_6OptionEE'
    D:/__IVT/IVT/src/gui/GUIFactory.cpp:118: undefined reference to `_imp___ZNK7QString7toAsciiEv'
    D:/__IVT/IVT/src/gui/GUIFactory.cpp:132: undefined reference to `_imp___ZN11QFileDialog15getOpenFileNameEP7QWidgetRK7QStringS4_S4_PS2_6QFlagsINS_6OptionEE'
    D:/__IVT/IVT/src/gui/GUIFactory.cpp:139: undefined reference to `_imp___ZNK7QString7toAsciiEv'
    ..\..\lib\win32/ivtguiqtd.lib(GUIFactory.o): In function `Z17LoadImageFromFilePKcP10CByteImage':
    D:/__IVT/IVT/src/gui/GUIFactory.cpp:171: undefined reference to `_imp___ZN12QApplicationC1ERiPPci'
    D:/__IVT/IVT/src/gui/GUIFactory.cpp:174: undefined reference to `_imp___ZN6QImageC1EPKcS1_'
    D:/__IVT/IVT/src/gui/GUIFactory.cpp:176: undefined reference to `_imp___ZNK6QImage6isNullEv'
    D:/__IVT/IVT/src/gui/GUIFactory.cpp:178: undefined reference to `_imp___ZNK6QImage5depthEv'
    D:/__IVT/IVT/src/gui/GUIFactory.cpp:178: undefined reference to `_imp___ZNK6QImage5depthEv'
    D:/__IVT/IVT/src/gui/GUIFactory.cpp:178: undefined reference to `_imp___ZNK6QImage5depthEv'
    D:/__IVT/IVT/src/gui/GUIFactory.cpp:180: undefined reference to `_imp___ZNK6QImage5depthEv'
    D:/__IVT/IVT/src/gui/GUIFactory.cpp:184: undefined reference to `_imp___ZNK6QImage5widthEv'
    D:/__IVT/IVT/src/gui/GUIFactory.cpp:185: undefined reference to `_imp___ZNK6QImage6heightEv'
    D:/__IVT/IVT/src/gui/GUIFactory.cpp:192: undefined reference to `_imp___ZNK6QImage5depthEv'
    D:/__IVT/IVT/src/gui/GUIFactory.cpp:193: undefined reference to `_imp___ZNK6QImage5depthEv'
    D:/__IVT/IVT/src/gui/GUIFactory.cpp:197: undefined reference to `_imp___ZN6QImage4bitsEv'
    D:/__IVT/IVT/src/gui/GUIFactory.cpp:198: undefined reference to `_imp___ZNK6QImage5depthEv'
    D:/__IVT/IVT/src/gui/GUIFactory.cpp:230: undefined reference to `_imp___ZN6QImageD1Ev'
    D:/__IVT/IVT/src/gui/GUIFactory.cpp:230: undefined reference to `_imp___ZN6QImageD1Ev'
    ..\..\lib\win32/ivtguiqtd.lib(GUIFactory.o): In function `~QByteArray':
    D:\__IVT\IVT\win32\IVTGUIQTLib/../../../Qt/include/QtCore/../../src/corelib/tools/qbytearray.h:383: undefined reference to `_imp___Z5qFreePv'
    ..\..\lib\win32/ivtguiqtd.lib(GUIFactory.o): In function `QString':
    D:\__IVT\IVT\win32\IVTGUIQTLib/../../../Qt/include/QtCore/../../src/corelib/tools/qstring.h:426: undefined reference to `_imp___ZN7QString16fromAscii_helperEPKci'
    ..\..\lib\win32/ivtguiqtd.lib(GUIFactory.o): In function `~QString':
    D:\__IVT\IVT\win32\IVTGUIQTLib/../../../Qt/include/QtCore/../../src/corelib/tools/qstring.h:883: undefined reference to `_imp___ZN7QString4freeEPNS_4DataE'
    ..\..\lib\win32/ivtguiqtd.lib(GUIFactory.o):D:\__IVT\IVT\win32\IVTGUIQTLib/../../../Qt/include/QtCore/../../src/corelib/kernel/qcoreapplication.h:102: undefined reference to `_imp___ZN16QCoreApplication4selfE'
    ..\..\lib\win32/ivtguiqtd.lib(QtApplicationHandler.o): In function `CQtApplicationHandler':
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:18: undefined reference to `_imp___ZN7QObjectC2EPS_'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:18: undefined reference to `vtable for CQtApplicationHandler'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:18: undefined reference to `vtable for CQtApplicationHandler'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:25: undefined reference to `_imp___ZN12QApplicationC1ERiPPci'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:30: undefined reference to `_imp___ZN12QApplicationC1ERiPPci'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:33: undefined reference to `_imp___Z13qFlagLocationPKc'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:33: undefined reference to `_imp___Z13qFlagLocationPKc'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:33: undefined reference to `_imp___ZN7QObject7connectEPKS_PKcS1_S3_N2Qt14ConnectionTypeE'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:42: undefined reference to `_imp___ZN7QObjectD2Ev'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:18: undefined reference to `_imp___ZN7QObjectC2EPS_'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:18: undefined reference to `vtable for CQtApplicationHandler'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:18: undefined reference to `vtable for CQtApplicationHandler'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:25: undefined reference to `_imp___ZN12QApplicationC1ERiPPci'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:30: undefined reference to `_imp___ZN12QApplicationC1ERiPPci'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:33: undefined reference to `_imp___Z13qFlagLocationPKc'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:33: undefined reference to `_imp___Z13qFlagLocationPKc'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:33: undefined reference to `_imp___ZN7QObject7connectEPKS_PKcS1_S3_N2Qt14ConnectionTypeE'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:42: undefined reference to `_imp___ZN7QObjectD2Ev'
    ..\..\lib\win32/ivtguiqtd.lib(QtApplicationHandler.o): In function `~CQtApplicationHandler':
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:44: undefined reference to `vtable for CQtApplicationHandler'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:44: undefined reference to `vtable for CQtApplicationHandler'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:50: undefined reference to `_imp___ZN7QObjectD2Ev'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:50: undefined reference to `_imp___ZN7QObjectD2Ev'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:44: undefined reference to `vtable for CQtApplicationHandler'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:44: undefined reference to `vtable for CQtApplicationHandler'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:50: undefined reference to `_imp___ZN7QObjectD2Ev'
    D:/__IVT/IVT/src/gui/Qt/QtApplicationHandler.cpp:50: undefined reference to `_imp___ZN7QObjectD2Ev'
    

    Maybe this helps understanding the problem…

    cheers,
    Max

     

  • Anonymous
    2010-12-04

    After another tweaking session, at the moment I'm quite sure the moc stuff works allright as the corresponding files were created and compiled.

    Anyway it did not matter for the KLTTrackerDemo compiler/linker errors.

    Max

     
  • Pedram Azad
    Pedram Azad
    2010-12-06

    Hi Max,

    your linker errors are all Qt related. The one thing is to generate the moc files with the moc compiler and to add them to the project. The other thing is to link against the required Qt libraries, I think they should be QtCore.lib, QtGui.lib and QtOpenGL.lib in the case of Qt4.

    Pedram

     
  • Max Wiertz
    Max Wiertz
    2010-12-06

    Hi,

    YES! Thanks man, that did the trick… I should have thought of that! Stupid enough I did not, actually I thought that everything was done in the ivtguiqt libs.

    Anyway, it works great now. I will write a short howto (probably later this week) and share this with you and the community for later reference.

    Thanks a lot for your help, I really appreciate,
    Max

     
  • Pedram Azad
    Pedram Azad
    2010-12-08

    Happy to hear that!

    Pedram