Enable C11 in Visual GDB

Sysprogs forums Forums VisualGDB Enable C11 in Visual GDB

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #29892
    vico
    Participant

    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?

     

    <GCCVersion>8.3.0</GCCVersion>
    <GDBVersion>8.2.1</GDBVersion>
    <BinutilsVersion>2.31.1</BinutilsVersion>

    • This topic was modified 3 years, 10 months ago by vico.
    #29894
    support
    Keymaster

    Hi,

    That would be normally in the project-level settings under the C/C++ -> Advanced tab. Please refer to this page for more details.

    #29895
    vico
    Participant

    I added options below, but still have the same problem.

    Language Standart for C files     C11 (-std=c11)

    Language Standart for C++ files    C++11 (-std=c++11)

    Attachments:
    You must be logged in to view attached files.
    #29897
    support
    Keymaster

    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.

    #31821
    gojimmypi
    Participant

    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

     

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.