I also encountered this error with File-New Project: I didn’t notice that the main() lived in a file with only a .c extension.
Can’t call C++ from a .c file, but oddly the compile error was on the target class file with the .cpp, not the main file.
Error Failed to compile IoT_BBQ_STM32.c. arm-none-eabi-gcc.exe exited with code 1
Error unknown type name 'class'
Error expected '=', ',', ';', 'asm' or '__attribute__' before '{' token