cancel
Showing results for 
Search instead for 
Did you mean: 

Error : unknown type name 'class'

CSand
Associate III

Hello,

I am migrating from Arduino to CubeIDE looking to have better IDE and better performance code. Migration was rather challenging but managed to go ahead. Still there is one new issue I have.

I created a C++ project using CubeMX but I get this error and others related to classes. Even I create C++ project the main file still has .C extention. To resolve I tried:

  • Change main.c file extension to cpp
  • Used File->New->Convert to C/C++

Still the error remains.

I expect is a newbie question, I am sorry. Could anyone help?

Thanks

1 REPLY 1
RSemm
Associate

This happens when you include an header with a class from a C- file.

C cannot call or use Classes.

When you write your own intermidiate mainCpp-funciton the main.c can call this mainCPP-function form a mainCpp.cpp. The mainCpp.h may not contain any classes.

Then you can include and use all Class-Headers from mainCpp.cpp