from a previous work, I have a library of classes for managing different type of sensors.
I would like to re-use this library on an XMOS project, but as far as I understood, there is no support for OOP in XC. Is this right?
I was thinking about writing wrapper functions for connecting the xc code to the cpp code in order to solve the problem but it seems that XC doesn't recognize classes at all:
Code: Select all
10:16:58 **** Incremental Build of configuration Default for project Lab10-CLASSES ****
xmake CONFIG=Default all
Checking build modules
No build modules used.
Analyzing Lab10-CLASSES.xc
In file included from ../src/Lab10-CLASSES.xc:14:
../src\Sensor.h:1:1: warning: type defaults to `int' in declaration of `class'
class Sensor {
^~~~~
../src\Sensor.h:1:1: warning: data definition has no type or storage class
class Sensor {
^~~~~
../src\Sensor.h:1:7: error: parse error before "Sensor"
class Sensor {
^
../src\Sensor.h:1:7: error: invalid declarator for function declaration
class Sensor {
^~~~~~
../src\Sensor.h:1:7: warning: return type defaults to `int'
class Sensor {
^~~~~~
../src\Sensor.h:3:1: error: use of undeclared identifer `public'
public:
^~~~~~
../src\Sensor.h:4:2: error: use of undeclared identifer `bool'
bool isEnabled;
^~~~
../src\Sensor.h:4:7: error: parse error before "isEnabled"
bool isEnabled;
^
../src\Sensor.h:19:2: warning: type defaults to `int' in declaration of `bool'
bool _isEnabled();
^~~~
../src\Sensor.h:19:2: warning: data definition has no type or storage class
bool _isEnabled();
^~~~
../src\Sensor.h:19:7: error: parse error before "_isEnabled"
bool _isEnabled();
^
../src\Sensor.h:19:7: warning: return type defaults to `int'
bool _isEnabled();
^~~~~~~~~~~~
../src\Sensor.h:20:1: error: parse error before '}' token
};
^
../src\Sensor.h:19:2: warning: unused variable `bool'
bool _isEnabled();
^~~~
xmake[1]: *** [.build/src/Lab10-CLASSES.xc.pca.xml] Error 1
xmake: *** [analyze] Error 2
10:16:59 Build Finished (took 1s.505ms)
You can find attached the test project I'm working on.
Is there a way to fix the problem or should I find another way?