I just wanted to try out Platformio with my already existing STM32 code, but building always fails.
Here is the problematic Header-File:
accumulator.hpp
class test{
private:
uint16_t num;
public:
float test();
};
This is the Error-Mesasge:
In file included from include/main.h:61:0,
from include/crc16.h:9,
from src\MSI.c:11:
include/accumulator.hpp:1:1: error: unknown type name ‘class’
class test{
It seems as if it has problems to recognize that .hpp is C++ code as the error says “class” is an unknown type.
Do you have any idea how to fix this?
All I could find was people having problems with .cpp files.
Is it possible that you have a syntax error in one of the files in the error stack there, which is causing the class keyword to be recognised incorrectly?
I’ve had that sort of thing myself a couple of times.
I realise you’ve compiled the code in the past without problem. Maybe the toolchain is different and finding something not found originally.
You are including a C++ header containg classes in a C file.
Since #include is just a fancy way of copy-pasting the file content into the includer, you now have a C file in which you define a C++ class. That can impossibly work.