vapandris
vapandris

Reputation: 29

C / C++ clearer #includes

I really don't like when I have to navigate backwards in my includes. I'd mutch more prefere if there would be a way to avoid that. Look at this folder for example:

enter image description here

Is there any way to tell the compiler (gcc) to start looking for includes from RootFolder, so I can say #include "Logic/Entitiy/Player.h" in my MainView.h/c or anywhere else, so I can avoid that unappealing backwards navigations.

Upvotes: 0

Views: 110

Answers (2)

I S
I S

Reputation: 456

include your RootFolder to compile stage like -I "RootFolder" then you can use #include "Logic/Entitiy/Player.h" just what you want.

Upvotes: 1

Thomas Sablik
Thomas Sablik

Reputation: 16454

You can pass include directories to your compiler. The configuration depends on the compiler. For gcc you set an include directory with -I. https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html

Upvotes: 5

Related Questions