Error when compiling custom class

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
TheRafal
Posts: 8
Joined: 30 Aug 2020 11:01

Error when compiling custom class

Post 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 
{

}cxx__class__Alarme;

//--------------------------------------------------------------------------------
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"


Alarme::Alarme()
{

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

TheRafal
Posts: 8
Joined: 30 Aug 2020 11:01

Re: Error when compiling custom class

Post 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...

p0lyg0n1
Posts: 184
Joined: 04 Aug 2016 07:14

Re: Error when compiling custom class

Post by p0lyg0n1 »

Hi,
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.

TheRafal
Posts: 8
Joined: 30 Aug 2020 11:01

Re: Error when compiling custom class

Post 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

Post Reply