Jump to content

C++ compile error brick IMU v2 Visual Studio 2010


JMG
 Share

Recommended Posts

Hello everyone

I recently bought a IMU brick and now I am trieing to run the IMU example (example_all_data.c).

I am using VS2010 and when I compile the project I get this error:

ip_connection.h(25): fatal error C1083: Cannot open include file: 'stdbool.h': No such file or directory

 

I have renamed  the .c extention to .cpp and under advance properties of the project I cahnged the compiler to C++. (Which seemed to be a problem in other threads. However, it is still not compiling).

Do you have any suggestion on how to fix my problem?

Thanks a lot.

Cheers,

Jeremy

Link to comment
Share on other sites

Thank you for your reply.

I have added this file.. now I am getting these errors:

stdbool.h(31): error C2059: syntax error : 'constant'

stdbool.h(31): error C3805: 'constant': unexpected token, expected either '}' or a ','

ip_connection.cpp(545): error C2440: 'return' : cannot convert from 'int' to '_Bool'
1>          Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)

at different lines in ip_connection.cpp and brick_imu_v2.cpp

Can you help here as well?

Thank you :)

 

Link to comment
Share on other sites

Sorry, I didn't think this through. You're compiling the code as C++. The problem is including stdbool.h there. It should not be included at all for C++ because its a C header.

Please remove the stdbool.h file again and change line 24 in ip_connection.h from this

#if (!defined __cplusplus && defined __GNUC__) || (defined _MSC_VER && _MSC_VER >= 1600)

to this

#if !defined __cplusplus && (defined __GNUC__ || (defined _MSC_VER && _MSC_VER >= 1600))

then try again.

Link to comment
Share on other sites

10 minutes ago, JMG said:

Sorry I am not native in C.

Don't worry, the problem is just that MSVC2010 is quite old and has some quirks that you run into now. The C/C++ bindings don't handles those correctly right now.

Please add these 3 lines in ip_connection.c at line 55:

#if defined _MSC_VER && _MSC_VER < 1900
#define snprintf _snprintf
#endif

 

Link to comment
Share on other sites

I have an additional question. not sure If I should start a new thread.

I want to use this IMU on a real time controller from NI. So I am using a Labview Realtime, which does not support .net assambly dlls. This is why I am trying to make it work with c++ and then create a dll out of it. Now I relized I need the daemon and viewer too on the target.

Is there a way to make the IMU run independetly from the Daemon executable? I don't think I can install them on the RT controller since it has Pharlap as OS...

Link to comment
Share on other sites

Brick Viewer is always optional. It is not necessary for using the different API bindings.

The different API bindings use a TCP/IP network connection to talk to the Tinkerforge hardware. If the hardware is connected to USB then Brick Daemon is required for the TCP/IP to USB translation.

You can replace the USB connection with a Ethernet or WIFI connection by adding a Ethernet or WIFI Master Extension to the stack. Then the API bindings can connect directly to the hardware over Ethernet or WIFI without the need for Brick Daemon.

What does you current hardware setup look like?

Link to comment
Share on other sites

Yes.

There are two versions of the Ethernet Master Extension, with and without PoE (Power over Ethernet).

The Ethernet Master Extension with PoE allows you to power the stack over the Ethernet cable using a PoE ready switch or a dedicated PoE injector. Resulting in a single cable connecting to the stack.

For the Ethernet Master Extension without PoE, you have to power the stack separately for example with a USB power supply connected to the Master Brick. Resulting in two cables running to the stack.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...