Page 1 of 1

Relative include paths

Posted: Wed Mar 07, 2007 05:55
by maxim
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?

Posted: Wed Mar 07, 2007 18:42
by kungfoomasta
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.

Posted: Thu Mar 08, 2007 00:57
by maxim
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 :)

Posted: Mon Mar 12, 2007 14:01
by LennyH
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. :)

Posted: Wed Mar 14, 2007 04:07
by maxim
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.

Posted: Wed Mar 14, 2007 18:48
by lindquist
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.

Posted: Thu Mar 15, 2007 03:14
by maxim
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?