简体   繁体   English

Eclipse CDT包含前缀“ C:”

[英]Eclipse CDT includes 'C:' prefixed

I am using Eclipse (Kepler) with the CDT (8.2.1) plugin for C++ development. 我正在将Eclipse(Kepler)与CDT(8.2.1)插件一起用于C ++开发。 My problem is that when I create a new class (New->Class) the default include in the X.cpp file which should be #include "Xh" actually is #include "C:Xh" . 我的问题是,当我创建一个新类(New-> Class)时,X.cpp文件中的默认include应该是#include "Xh"实际上是#include "C:Xh" The same thing happens when I use the 'Organize Includes' function of CDT. 当我使用CDT的“组织包含”功能时,也会发生同样的事情。

I was unable to find the reason for this behaviour. 我找不到这种行为的原因。 I would be really grateful if anyone could help me with this issue. 如果有人可以帮助我解决这个问题,我将不胜感激。

I had this problem too, I had created a new empty C++ project. 我也有这个问题,我创建了一个新的空C ++项目。 then created my src folder and started adding classes and folders as normal. 然后创建我的src文件夹,并像往常一样开始添加类和文件夹。 The solution i found was to set up the C++ include paths. 我发现的解决方案是设置C ++包含路径。

For those who do not know how to do that what i did was : make sure your open project is selected in eclipse go to : "project" > "properties" > "C/C++ Build" > "Settings" 对于那些不知道该怎么做的人,请执行以下操作:确保在eclipse中选择了打开的项目,请转到:“项目”>“属性”>“ C / C ++构建”>“设置”

Then add include paths within "GCC C++ Compiler" > "Includes" 然后在“ GCC C ++编译器”>“包含”中添加包含路径。

I am using workspace relative paths so i need this entry to exist: "${workspace_loc:/${ProjName}/src}" 我正在使用工作空间相对路径,因此我需要该条目存在:“ $ {workspace_loc:/ $ {ProjName} / src}”

Then beyond that add any other folders you need to access header files within. 然后,在其中添加其他任何文件夹,您都需要访问其中的头文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM