Johannes
Johannes

Reputation: 6717

C++14 Syntax in Eclipse CDT compiles but marked as syntax error (indexer)

Eclipse CDT gives me a syntax error for a valid C++14 syntax. Everything compiles and runs but the syntax highlighting is broken.

I have MinGW and Eclipse running. The C++14 program compiles and executes but I get incorrect syntax highlighting / syntax checking.

Here is my source code:

#include <iostream>
auto main() -> int
{
    //Binary Literals C++14 with Digit separators C++14
    auto seven = int{0b0000'0111};

    std::cout << seven << std::endl;
    std::cout << __cplusplus << std::endl;
    return int{0};
}

And here is the output / build log. You can see my compiler settings
(-D__GXX_EXPERIMENTAL_CXX0X__ -O0 -g3 -Wall -c -fmessage-length=0 -std=c++14) and the highlighting in it.

enter image description here

What do I need to setup so syntax detecition allows for C++14 syntax?

EDIT: it seems like the Indexer is the right bet - I am unable to make the Indexer work as intended.

On Windows 7 I am using MinGW. I open Providers and click on "CDT Built-In Compiler Settings MinGW" where I add -std=c++14. So the whole string is ${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}" -std=c++14 after I hit apply and ok I use Project->Index->rebuild in the hope of removing my errors. The Syntax error still persists.

This is essentially what is mentioned in the FAQ to get C++11 recognized by the indexer.

I have the latest MinGW Version installed. When I call g++ --version i get: g++ (GCC) 5.3.0 as a response. There is no manual for 5.3 but I would assume most of 5.4 is mostly valid for my version.

Upvotes: 2

Views: 826

Answers (1)

Johannes
Johannes

Reputation: 6717

The problem seems to be that the support for C++14 is not added yet.

Here is a bugreport that collects all C++14 issues. There is a depends on section where other bug reports alre listed. Among them the bug 451086 that specifically mentions Binary literals (N3472), Single-quotation-mark as digit separator (N3781).

So it seems like this issue is known and will be adressed at some point in the future.

Upvotes: 2

Related Questions