OpenViBE forum

The OpenViBE community
It is currently Thu Oct 19, 2017 10:54 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Aug 22, 2017 6:31 pm 
Offline

Joined: Tue Apr 11, 2017 10:44 am
Posts: 14
I 'm trying to connect openvibe to a c++ program using a VRPN server.

in the corresponding tutorial, it says I should run a script to get the header files which I did. I also added the headers to my project.

the problem is when compiling the same code provided in the tutorial I get the error :
undefined reference to `vrpn_Button_Remote::vrpn_Button_Remote(char const*, vrpn_Connection*)'

for the line of code :
Code:
VRPNButton = new vrpn_Button_Remote( "openvibe_vrpn_button@localhost" );

it also gives the same error for the analog buton.
also, I'm using the codeblocks IDE.

any ideas what might be the problem?

thanks for your help in advance.


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 23, 2017 9:46 am 
Offline

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

This looks like a linking error.
Did you correclty supply the vrpn lib folder to your linker ?

Cheers,


Top
 Profile  
Reply with quote  
PostPosted: Sat Aug 26, 2017 6:15 pm 
Offline

Joined: Tue Apr 11, 2017 10:44 am
Posts: 14
yes, it is a linking issue. I switched to visual studio. I do know I'm adding the library correctly since as a test I added the SDL library using their tutorial in here http://www.willusher.io/sdl2%20tutorials/2013/08/15/lesson-0-visual-studio and it was successful. But when I repeat the same procedure for the VRPN library it gives the linking error?

here is what I do :

1. I make an empty project in VS 2012. I add a c++ source file to it.

2. I go into the project setting and set Configuration to All Configurations.

3.in "Configuration Properties - > c/c++ -> General" set Additional Include Directories to the path of the include folrder.

4. in "Configuration Properties -> Linker -> General" set the Additional Library Directories to the path of the lib forder.

5. in "Configuration Properties -> Linker -> Input" set Additional Dependencies to "quat.lib;quatd.lib;vrpn.lib;vrpnd.lib;"

6. finally in "Configuration Properties -> Linker -> System" I set SubSystem to Console.

But when I compile the code I get these errors :

Code:
Error   3   error LNK1120: 1 unresolved externals   C:\Users\kiyarash\Desktop\visual studio\vrpn_header\Debug\vrpn_header.exe   1   1   vrpn_header
Error   2   error LNK2019: unresolved external symbol __dtoui3 referenced in function "void __cdecl vrpn_SleepMsecs(double)" (?vrpn_SleepMsecs@@YAXN@Z)   C:\Users\kiyarash\Desktop\visual studio\vrpn_header\vrpn_header\vrpn.lib(vrpn_Shared.obj)   vrpn_header
Error   1   error LNK2038: mismatch detected for '_MSC_VER': value '1800' doesn't match value '1700' in Source.obj   C:\Users\kiyarash\Desktop\visual studio\vrpn_header\vrpn_header\vrpn.lib(vrpn_Connection.obj)   vrpn_header



any help would be apppreciated .


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 28, 2017 8:21 am 
Offline

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

The error you are getting is explained in the third line
Code:
error LNK2038: mismatch detected for '_MSC_VER': value '1800' doesn't match value '1700' in Source.obj

Basically it says that you are trying to link something compiled with version 1700 of the Microsoft Compiler (ie VS 2012) against a lib compiled with version 1800 (ie VS 2013).

I suggest you use VS 2013 to compile.

Cheers,


Top
 Profile  
Reply with quote  
PostPosted: Sat Sep 02, 2017 6:46 pm 
Offline

Joined: Tue Apr 11, 2017 10:44 am
Posts: 14
thanks for your help. I didn't have access to VS 2013 so here is what I did to eventually solve the problem. I used VS 2017 but I think this is going to work for all versions.

1. download the vrpn project from GitHub . https://github.com/vrpn/vrpn/releases and unzip it.

2. open the solution in VS by opening "vrpn.lsn". select the "test_vrpn" project and all the projects in the library folder from the solution explorer. now right click and go to properties. under "configuration properties" sub tab "general" set he windows SDK option to the version of windows you have.
then in the c/c++ subtab under "code generation" set Runtime library to Multi threaded DLL (/MD). do the same procedure for your project. also, add the vrpn library as indicated by my previous post to your project.

3. now in the vrpn project compile "vrpn_test". this should make a vrpn.lib file. find it by searching it in the vrpn project folder.

4. in the lib folder of the vrpn library you have added to your project replace the vrpn.lib file.

5.now compile and run your own project.


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 2 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.