Camera SDK + Qt linking problem

Post Reply
wcislo
Posts: 2
Joined: Wed Mar 09, 2011 2:17 am

Camera SDK + Qt linking problem

Post by wcislo »

I have problems with integrating Camera SDK
with Qt 4.7.1. g++ version is 4.4.0,
system is Windiws 7.

Any ideas?


code (fragment):

#include
using namespace CameraLibrary;

void MainWindow::on_pushButton_opti_start_clicked()
{
CameraManager::X().WaitForInitialization();
}


command:

g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -mthreads -Wl -Wl,-subsystem,windows -o release\QtDemo.exe release/main.o release/mainwindow.o release/glwidget.o release/teapot.o release/moc_mainwindow.o release/qrc_qtdemo.o -L"c:\Qt\2010.05\qt\lib" -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmain release\qtdemo_res.o -Lc:/Qt/OpenCV2.2/lib/ -lopencv_highgui220 -lopencv_core220 "-Lc:/Program Files (x86)/NaturalPoint/OptiTrack Camera SDK/lib/" -lcameralibrary -lQtOpenGL4 -lQtGui4 -lQtCore4


linker errors:

release/mainwindow.o:mainwindow.cpp:(.text+0x41): undefined reference to `LockItem::LockItem()'
release/mainwindow.o:mainwindow.cpp:(.text+0x96): undefined reference to `LockItem::Lock()'
release/mainwindow.o:mainwindow.cpp:(.text+0xac): undefined reference to `LockItem::UnLock()'
release/mainwindow.o:mainwindow.cpp:(.text+0xd8): undefined reference to `LockItem::LockItem()'
release/mainwindow.o:mainwindow.cpp:(.text+0xf6): undefined reference to `CameraLibrary::CameraManager::CameraManager()'
release/mainwindow.o:mainwindow.cpp:(.text+0x83): undefined reference to `CameraLibrary::CameraManager::WaitForInitialization()'
release/mainwindow.o:mainwindow.cpp:(.text+0xbf): undefined reference to `CameraLibrary::CameraManager::WaitForInitialization()'

collect2: ld returned 1 exit status
LinusA
Posts: 37
Joined: Mon Nov 08, 2010 8:43 am
Location: Aachen, Germany
Contact:

Re: Camera SDK + Qt linking problem

Post by LinusA »

I'm using the Camera SDK beta 1.0.1 (which is the same as final 1.0.1), Qt 4.7.1, Windows 7 32bit, and Visual Studio 2008. It all works like a charm. I'm not too familiar with g++ unfortunately.

I'd advise you to do the usual step-by-step debugging: Remove/comment all references to CameraLibrary and the CameraManager. Let MainWindow::on_pushButton_opti_start_clicked() be an empty dummy function with just a debug-message to cout. If that works fine, you know it's not a Qt problem.


Have a look at this topic: http://forum.naturalpoint.com/forum/ubb ... 779&page=1

At first I thought I had the same problem, but now everything works with the default Camera SDK from the OptiTrack homepage. I didn't have to change any default project settings in my Visual Studio Solution.
beckdo
Posts: 520
Joined: Tue Jan 02, 2007 2:02 pm

Re: Camera SDK + Qt linking problem

Post by beckdo »

You have to use the MSVC compiler, not g++ unfortunately. You'll need to either download or build visual studio compatible QT libs and likely use Visual Studio as your IDE. You can still use QT designer as your UI layout editor.

I'm hoping to add a QT sample app to the Camera SDK to help minimize the pain of this.
LinusA
Posts: 37
Joined: Mon Nov 08, 2010 8:43 am
Location: Aachen, Germany
Contact:

Re: Camera SDK + Qt linking problem

Post by LinusA »

[quote=NaturalPoint - Doug]I'm hoping to add a QT sample app to the Camera SDK to help minimize the pain of this. [/quote]
Just a quick note: If you compile OpenCV with the option WITH_QT (and optionally WITH_QT_OPENGL) and use the commands cv::namedWindow() and/or cv::imshow(), then you have a working example that uses Qt (implicitely).

You can use the method described here http://forum.naturalpoint.com/forum/ubb ... mber=46195 to get the picture into an OpenCV matrix (the conversion to QImage is done by OpenCV internally). Displaying the pic or modifying it then is a cakewalk.

[If you however want to use this OpenCV example with Qt and your own Qt app with its own event loop, there is a little bug in OpenCV which you should be aware of: https://code.ros.org/trac/opencv/ticket/919 ]
wcislo
Posts: 2
Joined: Wed Mar 09, 2011 2:17 am

Re: Camera SDK + Qt linking problem

Post by wcislo »

Thank you all.

Using the MSVC compiler is not a solution for me, so if this is the only method to make an OptiTrack camera working, I will have to search for another tools...

Don't you think that building compiler-dependent libraries is not a good practice? I have no such problems with OpenCV, for example.
Post Reply