Eclipse c ++类生成格式 [英] Eclipse c++ class generation formating

查看:149
本文介绍了Eclipse c ++类生成格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经切换到Eclipse Mars.1,我不知道如何解决这个问题。



以下是问题:



我右键单击子文件夹MySubFolder并选择New-> Class



在类名字段中,我输入MyClass并使用MySubFolder填充命名空间,点击完成



生成的.cpp的合作伙伴包括带有括号和完整路径的surounder:

  #include< MySubFolder / MyClass.h> 

我想要这样:

  #includeMyClass.h

C ++ - >代码样式 - >包含样式 - >密切相关的标题 - >合作伙伴标题 - >使用包含文件的路径



并确保使用尖括号没有设置相同的选项,但没有一个会

解决方案

你有 src 列在我的包含路径中,如下所示:




然后CDT使用相对于$ {workspace_loc:/ $ {ProjName} / src}的尖括号计算包含目录。



您也可能拥有包含路径如果您不使用CDT的托管构建项目(例如,自动发现或手动管理的部分)。你编写自己的makefile,或者使用像cmake这样的工具),如下所示:





如果您创建不在任何包含目录中的类,它将使用双引号。


I've switched to Eclipse Mars.1 and I can't figure out how to fix this.

Here's the problem:

I right click on the subfolder MySubFolder and choose New->Class

In Class name field I enter MyClass and fill the namespace with MySubFolder and click on Finish

The generated .cpp has the partner include surounder with angle bracket and full path :

#include <MySubFolder/MyClass.h> 

I want it that way :

#include "MyClass.h"

I tried ticking C/C++->Code Style->Include Style->Closely Related Headers->Partner Header->Use path relative to the including file

And made sure "Use angle bracket" was not set for the same option but none will do

解决方案

You have "src" directory in your include paths you are passing to the compiler.

For example if I have "${workspace_loc:/${ProjName}/src}" listed in my include paths like this:

then CDT uses angle brackets relative to "${workspace_loc:/${ProjName}/src}" to calculate include directory.

You may also have the include paths in the auto-discovered or manually managed section if you are not using CDT's managed build projects (e.g. you write your own makefiles, or use tools like cmake), like this:

If you create a class not within any include directory, it uses double-quotes.

这篇关于Eclipse c ++类生成格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆