Page 1 of 1

Error when compiling custom class

Posted: 14 Oct 2020 15:00
by TheRafal
Hi, i've build some customs classes for my project but i've a problem when compiling the sketch. All have the same error... This classes work on a standard Arduino MEGA.

The error is : Alarme_ucxx.c:584: syntax error: token -> '}' ; column 1

Alarme is my custom Class.

Here is the code in Alarm_uccss.c where error is.

Code: Select all

//class Alarme DECLARATION
typedef struct cxx__class__Alarme_s 


and the Alarm.h file, i removed all lines, but error still here !

Code: Select all

#pragma once

// Alarme.h

#include "Arduino.h"

class Alarme {
and the Alarme.cpp, empty too but error always here

Code: Select all

#include "Alarme.h"


Any idea of why i've this error ? I don't really understand... I rewrote three times the code without copy past without succsess

Re: Error when compiling custom class

Posted: 19 Oct 2020 11:06
by TheRafal
So i try with different way to get my scketch work and i didn't use custom classes. Now i've another error. When compiling, the z-uno programmer make some error. Now, with Adafruti sensor libraries, it add double ; at the end of some functions... Why ? don't know, they are not in the original files but in the output files... Very frutrating to work with Z-uno...

Re: Error when compiling custom class

Posted: 21 Oct 2020 09:02
by p0lyg0n1
1. Add any field to class. For example int a. Your class has no fields. microC++ doesn’t support classes without fields.
2. Please post a code (about double). We will help you. You have to rewrite library a little to make it work with Z-Uno. You can look to libraries folder of Z-Uno cores to see already ported libraries. Use the same principles.

Re: Error when compiling custom class

Posted: 23 Oct 2020 10:03
by TheRafal
Hi Poly, before post here with the code a gave you, i've a full class with various field inside. I remove it one by one to test each time but error still here...

For the adafruit sensor, finally i didn't use it because i don't have time for this. It's to use with the MMA8451 and it's library... with the good datarate it seem to work properly