OpenViBE forum

The OpenViBE community
It is currently Mon Jun 25, 2018 3:36 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Jan 30, 2018 7:39 pm 
Offline

Joined: Sat Jan 20, 2018 10:15 am
Posts: 3
[size=150][size=200][size=150][/size][/size][/size]Hi!

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:
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


my .pro file is as followed:

Code:
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


here is my code:

Code:
#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 also put the dependancies folder next to my .pro file (the path is good because include directive works).
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.


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 31, 2018 8:38 am 
Offline

Joined: Tue Dec 04, 2012 3:53 pm
Posts: 709
Location: INRIA Rennes, FRANCE
That is a bit odd. It shouldn't need more than correct include/lib paths and linking the libs. Two ideas,

1) did you pick the same version of vrpn that openvibe uses? This can be found by either running the dependency installer from the OV source package or by a direct download (links may change over time),

http://openvibe.inria.fr/dependencies/w ... 31-dev.zip
http://openvibe.inria.fr/dependencies/w ... untime.zip

2) are you sure its even trying to link the vrpn lib when compiling? I'm not familar with the qt syntax. Maybe you can have some way to know this, like increasing verbosity.


Best,
Jussi


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 12, 2018 6:32 pm 
Offline

Joined: Sat Jan 20, 2018 10:15 am
Posts: 3
Hi,

(sorry for this late answer)

I have the same version of vrpn than openvibe. I get lib and include after running the dependency installer from the OV source package (and I also tried with direct download).

I am pretty sure that it's a linking trouble, because Qt see well the include files, but compilation failed when I try to declare an instance of a 'vrpn_Button_Remote::vrpn_Button_Remote' for example.

Anyone can try to link vrpn client with Qt creator?


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 19, 2018 9:29 am 
Offline

Joined: Thu Feb 09, 2017 10:17 am
Posts: 68
Hi,

Syntax seems to have changed for qmake.
If I believe http://doc.qt.io/qt-5/qmake-variable-reference.html, section "LIB", it seems that you should use this syntax
Code:
win32:LIBS += c:/mylibs/math.lib


Can you try this out ?
If that does not solve it, can you tell us your Qt version ? (since you are using qmake)
Another pointer would be checking path are corrects using message command in qmake.

Hope that helps,


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 26, 2018 11:16 am 
Offline

Joined: Sat Jan 20, 2018 10:15 am
Posts: 3
Hi,

I tried it, but it doesn't change...

Attachment:
fail_compil.png
fail_compil.png [ 49.12 KiB | Viewed 607 times ]


my Qt version:

Attachment:
qt_version.png
qt_version.png [ 15 KiB | Viewed 607 times ]


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Americanized by Maƫl Soucaze.