vprn "C++ client program" problem in compiling

About BCI and box tutorial/demo scenarios bundled with OpenViBE.
Post Reply
kiyarash
Posts: 27
Joined: Tue Apr 11, 2017 10:44 am

vprn "C++ client program" problem in compiling

Post by kiyarash »

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

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.

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

Re: vprn "C++ client program" problem in compiling

Post by tgaugry »

Hi,

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

Cheers,

kiyarash
Posts: 27
Joined: Tue Apr 11, 2017 10:44 am

Re: vprn "C++ client program" problem in compiling

Post by kiyarash »

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%20tutorial ... ual-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: Select all

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 .

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

Re: vprn "C++ client program" problem in compiling

Post by tgaugry »

Hi,

The error you are getting is explained in the third line

Code: Select all

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,

kiyarash
Posts: 27
Joined: Tue Apr 11, 2017 10:44 am

Re: vprn "C++ client program" problem in compiling

Post by kiyarash »

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.

Post Reply