简体   繁体   中英

OSX Eclipse CDT - root style includes

In a C++ project, in Eclipse CDT, one point of contention that I often have is the pain of removal a file because of the way it handles includes. In Xcode, it is possible to use the file name, or name relative from the project directory however eclipse requires me to often have backwards ".." relative paths which can be difficult to read, track as the project grows in complexity.

Includes currently look like this:

`../../model/geometry/Square.h`

Ideally i'd like to have all includes, pretend they are being called from the 'root of src directory' such as

`model/geometry/Square.h`

I understand that includes are essentially a preprocessor, find-replace instruction however this is 2012, there must be a way.

Of course there is a way of doing so :

Right click on your Project -> Properties -> Open the C/C++ General tab -> Path and Symbols -> select your language on the left (C++/C/Assembly) -> on the right, click on Add... And select your folder location!

Hope it helped!

Edit: Remember that if you include a folder, you can then include the files which are in that particular folder directly

#include "file.h" and not #include "folderIncluded/file.h"

Regards, Erwald

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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