Skip to main content
GameDev.net gamedev.net
🔒 Locked

VS2008 additional include

Started by M4573R Dec 5, 2011 at 4:09 AM 6 replies 1.8k views
Original Post
M4573R
M4573R
I can include headers inside other headers with relative paths such as "..\Folder\Header.h", but it does not work if I add to the project's additional include directories "..\Folder". It works for source files, but not header files.
TrianglesPCT
TrianglesPCT
Perhaps you need the trailing \

like this..

..\boost\

or in your case

..\Folder\
M4573R
M4573R

Perhaps you need the trailing \

like this..

..\boost\

or in your case

..\Folder\


Tried that :/


Hodgman
Hodgman
Relative include paths inside source files are relative to the source file.
Relative include paths in a project file are relative to the project file.

In your case, is your project file in the same directory as your source file?
M4573R
M4573R

Relative include paths inside source files are relative to the source file.
Relative include paths in a project file are relative to the project file.

In your case, is your project file in the same directory as your source file?


Indeed it is. The solution and each project with its source are in neighboring folders. So even if it was relative to the solution, project, or source, it should all use the same relative path.
Hodgman
Hodgman
Can you post up your actual directory structure / paths of all the relevant sources/headers/projects/solutions?

Also, what do you mean by "It works for source files, but not header files"?
M4573R
M4573R

Can you post up your actual directory structure / paths of all the relevant sources/headers/projects/solutions?

Also, what do you mean by "It works for source files, but not header files"?


The additional include directories work when I include in .cpp files, but not .h files.

Here is my folder tree:


+---Application
| Actions.h
| AppContext.h
| Application.cpp
| Application.h
| Application.vcproj
| MainMenu.cpp
| MainMenu.h
| Scene.h
| SceneManager.cpp
| SceneManager.h
| Window.cpp
| Window.h
|
+---Engine
| Engine.ncb
| Engine.sln
|
+---EntryPoint
| EntryPoint.vcproj
| main.cpp
|
+---Graphics
| AssetManager.h
| AssetManger.cpp
| CameraComponent.h
| ComponentEnum.cpp
| ComponentEnum.h
| Components.h
| ComponentsInt.h
| CullMethod.h
| D3DAsset.cpp
| D3DAsset.h
| DrawableComponent.h
| Forward.cpp
| Forward.h
| Graphics.cpp
| Graphics.h
| Graphics.vcproj
| GraphicsLib.h
| GraphicsWindow.h
| Material.h
| MaterialComponent.h
| MeshComponent.cpp
| MeshNode.h
| Pch.cpp
| Pch.h
| Renderer.cpp
| Renderer.h
| RenderMethod.h
| SimpleCull.cpp
| Texture.cpp
| Texture.h
| TextureComponent.cpp
| TextureComponent.h
| TransformComponent.cpp
| TransformComponent.h
|
+---Input
| Input.cpp
| Input.h
| Input.vcproj
| InputMessages.h
| KeyMap.h
| Keys.h
|
+---Math
| GameMath.h
| Math.vcproj
| Vec2.h
| Vec3.h
| xnacollision.cpp
| xnacollision.h
|
\---Universal
Assert.h
Component.cpp
Component.h
ComponentFactory.cpp
ComponentFactory.h
Entity.cpp
Entity.h
Handle.h
Helpers.h
NotifyDispatcher.h
Singleton.h
Timer.cpp
Timer.h
Universal.vcproj



As an example, I can include Timer.h inside Application.cpp, but I cannot inside Application.h. Inside of Application.h I must use "..\Universal\Timer.h"
M4573R
M4573R
*Sigh* I was missing the additional include directories in the final project the headers were getting included in. For instance, my application.h couldn't find graphics.h because main.cpp was including application and compiling it first without the proper include directories.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.