@Frederic-Baumann hi sir
can u give me the gpio library of your version ?
and why i cannot compile it in C++ compiler even though i already switch it from C compiler to C++
Here's my error
$ gccmips --std=gnu++11 sm_rotate.c -I../../libnewgpio/
gccmips: warning: environment variable 'STAGING_DIR' not defined
cc1: warning: command line option '-std=gnu++11' is valid for C++/ObjC++ but not for C [enabled by default]
In file included from ../libnewgpio/hdr/GPIOPin.h:5:0,
from sm_rotate.c:5:
../libnewgpio/hdr/GPIOTypes.h:37:24: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
GPIO_Irq_Handler_Object{
^
../libnewgpio/hdr/GPIOTypes.h:44:28: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
GPIO_PulseIn_Handler_Object{
^
In file included from sm_rotate.c:5:0:
../libnewgpio/hdr/GPIOPin.h:7:1: error: unknown type name 'class'
class GPIOPin {
^
../libnewgpio/hdr/GPIOPin.h:7:15: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
class GPIOPin {
^
In file included from ../libnewgpio/hdr/GPIOAccess.h:13:0,
from sm_rotate.c:6:
../libnewgpio/hdr/GPIOPwmPin.h:10:1: error: unknown type name 'class'
class GPIOPwmPin {
^
../libnewgpio/hdr/GPIOPwmPin.h:10:18: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
class GPIOPwmPin {
^
In file included from ../libnewgpio/hdr/GPIOAccess.h:14:0,
from sm_rotate.c:6:
../libnewgpio/hdr/GPIOIrqInfo.h:7:5: error: unknown type name 'GPIO_Irq_Type'
GPIO_Irq_Type type;
^
../libnewgpio/hdr/GPIOIrqInfo.h:9:5: error: unknown type name 'GPIO_Irq_Handler_Object'
GPIO_Irq_Handler_Object * handlerObj;
^
../libnewgpio/hdr/GPIOIrqInfo.h:10:5: error: unknown type name 'bool'
bool enabled;
^
In file included from ../libnewgpio/hdr/GPIOAccess.h:15:0,
from sm_rotate.c:6:
../libnewgpio/hdr/GPIOPulseInPin.h:7:1: error: unknown type name 'class'
class GPIOPulseInPin {
^
../libnewgpio/hdr/GPIOPulseInPin.h:7:22: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
class GPIOPulseInPin {
^
In file included from sm_rotate.c:6:0:
../libnewgpio/hdr/GPIOAccess.h:21:1: error: unknown type name 'class'
class GPIOAccess {
^
../libnewgpio/hdr/GPIOAccess.h:21:18: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
class GPIOAccess {
^
sm_rotate.c: In function 'main':
sm_rotate.c:14:2: error: unknown type name 'GPIOPin'
GPIOPin* pins[4];
^
sm_rotate.c:15:12: error: 'new' undeclared (first use in this function)
pins[0] = new GPIOPin(0);
^
sm_rotate.c:15:12: note: each undeclared identifier is reported only once for each function it appears in
sm_rotate.c:15:16: error: expected ';' before 'GPIOPin'
pins[0] = new GPIOPin(0);
^
sm_rotate.c:16:16: error: expected ';' before 'GPIOPin'
pins[1] = new GPIOPin(1);
^
sm_rotate.c:17:16: error: expected ';' before 'GPIOPin'
pins[2] = new GPIOPin(6);
^
sm_rotate.c:18:16: error: expected ';' before 'GPIOPin'
pins[3] = new GPIOPin(7);
^
sm_rotate.c:20:2: error: 'for' loop initial declarations are only allowed in C99 mode
for (int i = 0; i < 4; i++)
^
sm_rotate.c:20:2: note: use option -std=c99 or -std=gnu99 to compile your code
sm_rotate.c:22:10: error: request for member 'setDirection' in something not a structure or union
pins[i]->setDirection(GPIO_OUTPUT);
^
sm_rotate.c:25:6: error: redefinition of 'i'
int i = 0, j = 3;
^
sm_rotate.c:20:11: note: previous definition of 'i' was here
for (int i = 0; i < 4; i++)
^
sm_rotate.c:28:10: error: request for member 'set' in something not a structure or union
pins[i]->set(1);
^
sm_rotate.c:30:10: error: request for member 'set' in something not a structure or union
pins[j]->set(0);