0

I am using C++ to establish a connection with Sensable Phantom Omni haptic device with H3D toolkit. These lines of code give me some challenges and will not compile successfully:

#include <H3D/PhantomDevice.h>
#include <HAPI/PhantomHapticsDevice.h>

using namespace H3D;
...
H3DNodeDatabase PhantomDevice::database("PhantomDevice", &(newInstance<PhantomDevice>),typeid(PhantomDevice),&H3DHapticsDevice::database);  //line 36
namespace PhantomDeviceInternals {...}
unsigned int PhantomDevice::nr_initialized_devices = 0;  //line 60
bool PhantomDevice::started_scheduler = false;          //line 61
unsigned int PhantomDevice::render_shapes_called = 0;  //line 62
...

The resulting error messages are:

I have the following errors:

PhantomDevice.cpp:36: error: definition of static data member 'H3D::PhantomDevice::database' of dllimport'd class.
PhantomDevice.cpp:60: error: definition of static data member 'H3D::PhantomDevice::nr_initialized_devices' of dllimport'd class.
PhantomDevice.cpp:61: error: definition of static data member 'H3D::PhantomDevice::started_scheduler' of dllimport'd class.
PhantomDevice.cpp:62: error: definition of static data member 'H3D::PhantomDevice::render_shapes_called' of dllimport'd class.
make.exe: *** [PhantomDevice.o] Error 1

Please anyone can suggest what to do as I am stuck in the mud now.

Olatunji
  • 59
  • 5
  • Why are you trying to define static members of a class that comes from a library? – 1201ProgramAlarm Sep 08 '17 at 02:25
  • The variables are defined as protected static in the library. I only defined and initialized as: unsigned int PhantomDevice::nr_initialized_devices = 0; bool PhantomDevice::started_scheduler = false; unsigned int PhantomDevice::render_shapes_called = 0; – Olatunji Sep 09 '17 at 08:35
  • They're defined in the library. You should not be defining them. – 1201ProgramAlarm Sep 09 '17 at 19:42
  • I changed the LoCs to: PhantomDevice::nr_initialized_devices = 0; PhantomDevice::started_scheduler = false; PhantomDevice::render_shapes_called = 0; I got these errors: PhantomDevice.cpp:36: error: definition of static data member 'H3D::PhantomDevice::database' of dllimport'd class. PhantomDevice.cpp:57: error: expected constructor, destructor, or type conversion before '=' token PhantomDevice.cpp:57: error: expected `,' or `;' before '=' token PhantomDevice.cpp:58: error: expected constructor, destructor, or type conversion before '=' token Please Check! – Olatunji Sep 11 '17 at 07:02

0 Answers0