Jump to content
  • Advertisement
Sign in to follow this  
M4573R

VS2008 additional include

This topic is 2569 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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"?

Share this post


Link to post
Share on other sites

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"

Share this post


Link to post
Share on other sites
*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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!