View Single Post
  #9  
Old 02-24-2006, 01:38 PM
MiamiTodd MiamiTodd is offline
Member
 
Join Date: Feb 2006
Posts: 15
Perhaps I spoke a bit too soon. When I try to create a project and compile it after compiling the VRPN source code I get all sorts of errors regarding the extern "C" lines and other extern lines in the VRPN source if I compile it as a C module.

I did manage to get to a certain point using C++ project though. But when I try to compile the code I get the following error:
...\extender\Tracker.cpp(8): error C2664: 'int vrpn_Tracker_Remote::register_change_handler(void *,vrpn_TRACKERCHANGEHANDLER,vrpn_int32)' : cannot convert parameter 2 from 'void (void *,vrpn_TRACKERCB)' to 'vrpn_TRACKERCHANGEHANDLER'

I'm trying to get a dll compiled from the below code:

(Tracker.h)
Code:
#include <vrpn_Tracker.h>

class Tracker{
public:
	Tracker(char* address);
	int* getPosition();
	void handlePos(void *userdata, vrpn_TRACKERCHANGEHANDLER t);
	
	vrpn_Tracker_Remote* tracker;
	vrpn_float64* lastPosition;
};
(Tracker.cpp)
Code:
#include <string.h>
#include <vrpn_Tracker.h>
#include "Tracker.h"

Tracker::Tracker(char* address){
	tracker = new vrpn_Tracker_Remote(address);
	//Setup callback for when new position data comes in
	tracker->register_change_handler(NULL, handlePos);
	lastPosition = new vrpn_float64[3];
}

Tracker::handlePos(void *userdata, vrpn_TRACKERCB t){
	lastPosition[0] = t.pos[0];
	lastPosition[1] = t.pos[1];
	lastPosition[2] = t.pos[2];
}

Tracker::getPosition(){
	return lastPosition;
}
I've tried chaning several things such as the vrpn_TRACKERCB to the vrpn_TRACKERCHANGEHANDLER but this doesn't seem to make any headway. I am unfortunately not familiar enough with C/C++ to recognize any simple errors I might be inducing here. Any help you can offer is greatly appreciated.
Reply With Quote