itead / Segnix

An Arduino-like Project Based on Linux/Raspberry Pi
110 stars 74 forks source link

Compiler Error #9

Open Philipp97714 opened 7 years ago

Philipp97714 commented 7 years ago

The follwing code can't be compiled with Raspberry Pi (with Arduino IDE works fine).

#include <NexConfig.h>
#include <NexNumber.h>
#include <NexText.h>
#include <NexPage.h>

NexPage pgBoot = NexPage(0, 0, "boot");
NexNumber nxADay = NexNumber(0, 2, "boot.day");
NexText nxBoot = NexText(0, 4, "boot.error");

uint32_t number;

void setup() {
 nexInit();
}

void loop() {}

if I try to compile with "segnix nex nex.c" I get the following errors:

compile by .c
In file included from /usr/local/include/NexTouch.h:25:0,
                 from /usr/local/include/NexNumber.h:20,
                 from nex.c:6:
/usr/local/include/NexObject.h:34:1: error: unknown type name ‘class’
 class NexObject
 ^
/usr/local/include/NexObject.h:35:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
 {
 ^
In file included from /usr/local/include/NexNumber.h:20:0,
                 from nex.c:6:
/usr/local/include/NexTouch.h:56:1: error: unknown type name ‘class’
 class NexTouch: public NexObject
 ^
/usr/local/include/NexTouch.h:56:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
 class NexTouch: public NexObject
               ^
In file included from /usr/local/include/NexNumber.h:21:0,
                 from nex.c:6:
/usr/local/include/NexHardware.h:32:1: error: unknown type name ‘bool’
 bool nexInit(void);
 ^
/usr/local/include/NexHardware.h:45:14: error: unknown type name ‘NexTouch’
 void nexLoop(NexTouch *nex_listen_list[]);
              ^
/usr/local/include/NexHardware.h:51:1: error: unknown type name ‘bool’
 bool recvRetNumber(uint32_t *number, uint32_t timeout = 100);
 ^
/usr/local/include/NexHardware.h:51:55: error: expected ‘;’, ‘,’ or ‘)’ before ‘=’ token
 bool recvRetNumber(uint32_t *number, uint32_t timeout = 100);
                                                       ^
/usr/local/include/NexHardware.h:52:69: error: expected ‘;’, ‘,’ or ‘)’ before ‘=’ token
 uint16_t recvRetString(char *buffer, uint16_t len, uint32_t timeout = 100);
                                                                     ^
/usr/local/include/NexHardware.h:54:1: error: unknown type name ‘bool’
 bool recvRetCommandFinished(uint32_t timeout = 100);
 ^
/usr/local/include/NexHardware.h:54:46: error: expected ‘;’, ‘,’ or ‘)’ before ‘=’ token
 bool recvRetCommandFinished(uint32_t timeout = 100);
                                              ^
In file included from nex.c:6:0:
/usr/local/include/NexNumber.h:30:1: error: unknown type name ‘class’
 class NexNumber: public NexTouch
 ^
/usr/local/include/NexNumber.h:30:16: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
 class NexNumber: public NexTouch
                ^
In file included from nex.c:7:0:
/usr/local/include/NexText.h:30:1: error: unknown type name ‘class’
 class NexText: public NexTouch
 ^
/usr/local/include/NexText.h:30:14: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
 class NexText: public NexTouch
              ^
In file included from nex.c:8:0:
/usr/local/include/NexPage.h:31:1: error: unknown type name ‘class’
 class NexPage: public NexTouch
 ^
/usr/local/include/NexPage.h:31:14: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
 class NexPage: public NexTouch
              ^
nex.c:12:1: error: unknown type name ‘NexPage’
 NexPage pgBoot = NexPage(0, 0, "boot");
 ^
nex.c:12:1: error: initializer element is not constant
nex.c:13:1: error: unknown type name ‘NexNumber’
 NexNumber nxADay = NexNumber(0, 2, "boot.day");
 ^
nex.c:13:1: error: initializer element is not constant
nex.c:14:1: error: unknown type name ‘NexText’
 NexText nxBoot = NexText(0, 4, "boot.error");
 ^
nex.c:14:1: error: initializer element is not constant