I am trying to build a VRPN client using Qt Creator as an IDE. I need Qt Creator because I am using it to the User interface and I wanted to add to my project a vrpn client.
So I followed the openVibe tutorial but I got some linking error:
Code: Select all
C:\Document\ConnectVRPN\main.cpp:33: erreur : undefined reference to `vrpn_Button_Remote::vrpn_Button_Remote(char const*, vrpn_Connection*)'
C:\Documents\ConnectVRPN\main.cpp:40: erreur : undefined reference to `vrpn_Analog_Remote::vrpn_Analog_Remote(char const*, vrpn_Connection*)'
collect2.exe:-1: erreur : error: ld returned 1 exit status
Code: Select all
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/vrpn/lib/ -lvrpn
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/vrpn/lib/ -lvrpnd
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/vrpn/lib/ -lquat
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/vrpn/lib/ -lquatd
INCLUDEPATH += $$PWD/vrpn/include
DEPENDPATH += $$PWD/vrpn/include
Code: Select all
#include <iostream>
#include "vrpn/include/vrpn_Button.h"
#include "vrpn/include/vrpn_Analog.h"
void VRPN_CALLBACK vrpn_button_callback(void* user_data, vrpn_BUTTONCB button)
{
std::cout << "Button ID : " << button.button << " / Button State : " << button.state << std::endl;
if (button.button == 1)
{
*(bool*)user_data = false;
}
}
void VRPN_CALLBACK vrpn_analog_callback(void* user_data, vrpn_ANALOGCB analog)
{
for (int i = 0; i < analog.num_channel; i++)
{
std::cout << "Analog Channel : " << i << " / Analog Value : " << analog.channel[i] << std::endl;
}
}
int main(int argc, char** argv)
{
/* flag used to stop the program execution */
bool running = true;
/* VRPN Button object */
vrpn_Button_Remote* VRPNButton;
/* Binding of the VRPN Button to a callback */
VRPNButton = new vrpn_Button_Remote( "openvibe_vrpn_button@localhost" );
VRPNButton->register_change_handler( &running, vrpn_button_callback );
/* VRPN Analog object */
vrpn_Analog_Remote* VRPNAnalog;
/* Binding of the VRPN Analog to a callback */
VRPNAnalog = new vrpn_Analog_Remote( "openvibe_vrpn_analog@localhost" );
VRPNAnalog->register_change_handler( NULL, vrpn_analog_callback );
/* The main loop of the program, each VRPN object must be called in order to process data */
while (running)
{
VRPNButton->mainloop();
}
return 0;
}
I haven't the vrpn.a may be it's why it doesn't link well but I don't know how to find this file.
If you have succeed to build a vrpn client with Qt or you have any idea, please tell me.