I have C++ project in my Visual Studio 19 that builds binary for my Raspberry Pi with help of cross compiler and Visual GDB. I’m trying to use enum class that is part of C11 standard:
enum class OperationRegime { ECO, MAX };
Got error while build:
error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token enum class OperationRegime { ECO, MAX }; ^
How to enable C11 standart in Visual C++ Visual GDB project?
Most likely, your toolchain does not support this language feature, or there is an error in the source file, or you need to select a different language standard.
Our best advice would be to try dumping the gcc command line used by VisualGDB as described here and verifying that the -std option gets passed to gcc.
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