Eclipse CDT中的C ++ 14语法可以编译,但标记为语法错误(索引器) [英] C++14 Syntax in Eclipse CDT compiles but marked as syntax error (indexer)
问题描述
Eclipse CDT为我提供了有效C ++ 14语法的语法错误。
一切都可以编译并运行,但是语法高亮显示已损坏。
Eclipse CDT gives me a syntax error for a valid C++14 syntax. Everything compiles and runs but the syntax highlighting is broken.
我正在运行MinGW和Eclipse。 C ++ 14程序可以编译并执行,但是语法突出显示/语法检查不正确。
I have MinGW and Eclipse running. The C++14 program compiles and executes but I get incorrect syntax highlighting / syntax checking.
这是我的源代码:
#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};
}
这是输出/构建日志。
您可以看到我的编译器设置
( -D__GXX_EXPERIMENTAL_CXX0X__ -O0 -g3 -Wall -c -fmessage-length = 0 -std = c ++ 14
)并在其中突出显示。
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.
什么我是否需要设置以便语法检测允许C ++ 14语法?
What do I need to setup so syntax detecition allows for C++14 syntax?
编辑:看来索引器是正确的选择-我无法使索引器
it seems like the Indexer is the right bet - I am unable to make the Indexer work as intended.
在Windows 7上,我正在使用MinGW。
我打开提供程序,然后单击 CDT内置编译器设置MinGW,在其中添加 -std = c ++ 14
。因此,整个字符串为 $ {COMMAND} $ {FLAGS} -E -P -v -dD $ {INPUTS} -std = c ++ 14
应用并确定,我希望使用Project-> Index-> rebuild来消除错误。语法错误仍然存在。
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.
这基本上是通过索引器识别C ++ 11的常见问题解答。
我安装了最新的MinGW版本。当我调用 g ++ --version
时,我得到: g ++(GCC)5.3.0
作为响应。 没有适用于5.3的手册,但我认为5.4的大部分对我的版本有效。 / p>
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.
推荐答案
问题似乎是尚未添加对C ++ 14的支持。
The problem seems to be that the support for C++14 is not added yet.
这里是一个错误报告,它收集了所有C ++ 14问题。
依赖于部分列出了其他错误报告。其中的错误 451086 特别提到二进制文字(N3472)
,作为数字分隔符的单引号(N3781)
。
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.
这篇关于Eclipse CDT中的C ++ 14语法可以编译,但标记为语法错误(索引器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!