[SOLVED] C++ errors in NRF file that compiles cleanly with other IDE's

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] C++ errors in NRF file that compiles cleanly with other IDE's

    Error :

    ../../../../../../components/libraries/util/app_util.h:118:55: error: expected constructor, destructor, or type conversion before ‘(’ token

    in this source (written by Nordic):

    #ifdef __GNUC__
    #define STATIC_ASSERT_SIMPLE(EXPR) _Static_assert(EXPR, "unspecified message")

    included from a .cpp file.

    I am porting a project from Eclipse, where this compiles cleanly with C++ using the GNU ARM tools. AFAIK this is valid code, so I suspect my project options or the generated compiler command is not correct.

    I have tried changing Project>Options>Compiler><foo> Language Standard to various values including GNU++14 etc.

    How do you view the exact compiler command in the transcript?
  • More info: _Static_assert should be a compiler keyword since C11. I think the compiler is not recognizing it as a keyword.

    Does SES install its own versions of the GCC ARM toolchain? Maybe my other IDE is using a different compiler ((different version?)
  • Hello,

    Thank you for your inquiry.

    _Static_assert is only a keyword in C.
    For C++ use static_assert.

    Does SES install its own versions of the GCC ARM toolchain? Maybe my other IDE is using a different compiler ((different version?)

    Quite possible that different versions are used. To find out which one ES is using go to Help->About SEGGER Embedded Studio

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.