Relative include paths

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

maxim
Just popping in
Just popping in
Posts: 10
Joined: Wed Mar 07, 2007 05:09

Relative include paths

Postby maxim » Wed Mar 07, 2007 05:55

Hi,

It seems that include statements in the CEGUI are are relative to the base directory. This is a bit problematic as it requires a user to define a global include path to the CEGUI in able to include CEGUI in a project.

There wouldn't be such a problem if you used relative include as relative to the actual file path.

So instead of having includes such as:

----CEGUIBase/Elements/CEGUIEditbox.h----
#include "CEGUIBase.h"
#include "CEGUIWindow.h"
#include "elements/CEGUIEditboxProperties.h"

please use:

----CEGUIBase/Elements/CEGUIEditbox.h----
#include "../CEGUIBase.h"
#include "../CEGUIWindow.h"
#include "CEGUIEditboxProperties.h"


Any comments?

User avatar
kungfoomasta
Not too shy to talk
Not too shy to talk
Posts: 34
Joined: Wed Apr 06, 2005 08:25

Postby kungfoomasta » Wed Mar 07, 2007 18:42

Are you using Visual Studio?

You can define "Additional Include Directories" for your given project. This doesn't really seem like a problem to me.

I believe the path to set them is as follows:

1. Right click on the project in the solution explorer, select "Properties" at the bottom.
2. Click on the C/C++ item in the TreeView Control.
3. Click on the field next to "Additional Include Directories", and add in the locations of files you wish to include into your project.

maxim
Just popping in
Just popping in
Posts: 10
Joined: Wed Mar 07, 2007 05:09

Postby maxim » Thu Mar 08, 2007 00:57

kungfoomasta wrote:Are you using Visual Studio?

You can define "Additional Include Directories" for your given project. This doesn't really seem like a problem to me.


Thanks for the reply. I'm aware that I could add a project specific include directory, but I think one should be able to include CEGUI headers without doing that. It's not that big deal, but as I'm failing to see the benefits of the current approach, it would be a sane thing to do :)

LennyH
Quite a regular
Quite a regular
Posts: 92
Joined: Thu Nov 30, 2006 20:50

Postby LennyH » Mon Mar 12, 2007 14:01

Eh, bad idea. See, when you make it so that the user/programmer/whatever has to set the base include path, as described by kungfoomasta, it's an additional step. But, what it means is that you are not limiting where you can actually place your project.

For instance, for you it may be convenient to '#include "../CEGUIBase.h"' but what happens when you send me that file and my directory structure for my solutions and CEGUI and etc are completely different? Chaos, that's what :p Because there is no CEGUIBase.h at ../

And why should there be? It makes much more sense to have a global style path, so that when you send me something, I don't have to change anything at all. I just compile, build, and go on my merry way. :)

maxim
Just popping in
Just popping in
Posts: 10
Joined: Wed Mar 07, 2007 05:09

Postby maxim » Wed Mar 14, 2007 04:07

LennyH wrote:Eh, bad idea. See, when you make it so that the user/programmer/whatever has to set the base include path, as described by kungfoomasta, it's an additional step. But, what it means is that you are not limiting where you can actually place your project.

For instance, for you it may be convenient to '#include "../CEGUIBase.h"' but what happens when you send me that file and my directory structure for my solutions and CEGUI and etc are completely different? Chaos, that's what :p Because there is no CEGUIBase.h at ../

And why should there be? It makes much more sense to have a global style path, so that when you send me something, I don't have to change anything at all. I just compile, build, and go on my merry way. :)

I think your comment is little bit off the point. I was talking internal project includes. What I mean is that a project should use relative include paths when referencing a file *inside the same project*. This doesn't result in chaos as the directory structure is fixed - you wouldn't need to change anything and would be free to choose whether to use global include paths in your projects using CEGUI or not.

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Postby lindquist » Wed Mar 14, 2007 18:48

Dont expect this to change. LennyH has a point. with the current setup the includes are "directory" agnostic. e.g. they just reference cegui files. not some specific directory structure. You should provide proper include paths for your project for your compiler yourself. This is not the job of CEGUI but you!

Also, the provided premake and autotools configurations are handling the current setup just fine AFAIK.

maxim
Just popping in
Just popping in
Posts: 10
Joined: Wed Mar 07, 2007 05:09

Postby maxim » Thu Mar 15, 2007 03:14

lindquist wrote:Dont expect this to change. LennyH has a point. with the current setup the includes are "directory" agnostic. e.g. they just reference cegui files. not some specific directory structure. You should provide proper include paths for your project for your compiler yourself. This is not the job of CEGUI but you!

Also, the provided premake and autotools configurations are handling the current setup just fine AFAIK.


I think you are missing the point as well. I'm talking about intra-project includes here. Inter-project ones should by all means be "directory agnostic". How exactly an i nclude such as "#include "elements/CEGUIComboboxProperties.h"" is "directory agnostic" anyway?


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 14 guests