Error : unknown type name 'class'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2019-09-23 4:50 AM
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
- Labels:
-
STM32CubeIDE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-09-14 7:13 AM
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
