Page 1 of 1

Compiling errors with gcc and g++

Posted: Sun Aug 30, 2009 2:48 pm
by kjacob84
Someone please help me with using the C++ code.

I've been reading everything I can on the forms and it seems like there either using a different compiler or different OS. I'm using Server 08 64bit. I'm trying to get the sample code from the website to compil using minGW on windows. I've extracted the samples and added the header file in the same directory. I've also followed the not to ignor out “//__declspec (deprecated” and that got ride of a lot of the errors, but I'm see having the issues seen below.

I'm just trying to get it to work in the consol.


C:\Users\user\Desktop\standardC>gcc Servo-simple.c -o Servo.exe
Servo-simple.c:12: error: syntax error before "namespace"
Servo-simple.c:12: warning: data definition has no type or storage class
Servo-simple.c: In function `servo_simple':
Servo-simple.c:81: warning: passing arg 2 of `CPhidget_set_OnAttach_Handler' from incompatible pointer type
Servo-simple.c:82: warning: passing arg 2 of `CPhidget_set_OnDetach_Handler' from incompatible pointer type
Servo-simple.c:83: warning: passing arg 2 of `CPhidget_set_OnError_Handler' from incompatible pointer type
Servo-simple.c:87: warning: passing arg 2 of `CPhidgetServo_set_OnPositionChange_Handler' from incompatible pointer type

C:\Users\user\Desktop\standardC>g++ Servo-simple.c -o Servo.exe
Servo-simple.c: In function `int servo_simple()':
Servo-simple.c:81: error: invalid conversion from `int (*)(_CPhidget*, void*)' to `int (*)(_CPhidget*, void*)'
Servo-simple.c:81: error: initializing argument 2 of `int CPhidget_set_OnAttach_Handler(_CPhidget*, int (*)(_CPhidget*, void*), void*)'
Servo-simple.c:82: error: invalid conversion from `int (*)(_CPhidget*, void*)' to `int (*)(_CPhidget*, void*)'
Servo-simple.c:82: error: initializing argument 2 of `int CPhidget_set_OnDetach_Handler(_CPhidget*, int (*)(_CPhidget*, void*), void*)'
Servo-simple.c:83: error: invalid conversion from `int (*)(_CPhidget*, void*, int, const char*)' to `int (*)(_CPhidget*, void*, int, const char*)
'
Servo-simple.c:83: error: initializing argument 2 of `int CPhidget_set_OnError_Handler(_CPhidget*, int (*)(_CPhidget*, void*, int, const char*)
, void*)'
Servo-simple.c:87: error: invalid conversion from `int (*)(_CPhidgetServo*, void*, int, double)' to `int (*)(_CPhidgetServo*, void*, int, double)
'
Servo-simple.c:87: error: initializing argument 2 of `int CPhidgetServo_set_OnPositionChange_Handler(_CPhidgetServo*, int (*)(_CPhidgetServo*,
void*, int, double), void*)'

C:\Users\user\Desktop\standardC>

Re: Compiling errors with gcc and g++

Posted: Sun Aug 30, 2009 9:37 pm
by wantphidgettowork
read post here, same errors
viewtopic.php?f=37&t=3079

if you compile with gcc for C, they are only warnings, if you compile with g++ for C++ they turn into errors. Also waiting for a reply :(