VS2008 additional include

Started by
6 comments, last by M4573R 12 years, 4 months ago
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.
Advertisement
Perhaps you need the trailing \

like this..

..\boost\

or in your case

..\Folder\

Perhaps you need the trailing \

like this..

..\boost\

or in your case

..\Folder\


Tried that :/


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?

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.
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"?

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"
*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.

This topic is closed to new replies.

Advertisement