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

Using static libraries...

Started by TheWanderer Aug 23, 2006 at 8:17 AM 4 replies 2.5k views
Original Post
TheWanderer
TheWanderer
So I've been developing a game engine for some time now and recently got to the point where I want to use it in a small demo. I created another project (I'm using MSVC 2005) and added a reference to the engine static library and addeded a #include to the Demo. Now, the engine compiles fine, but when the compiler reaches the Demo, it throws an error concerning a .file which it cannot open. The weird thing (to me) is that the include is in the Engine project. The include file concerns another system (Ogre3D) which I included in the engine . Why is the Demo failing here? Why is it trying to open a file which is not really a part of its project? Should it not be incapsulated within the engine's static lib?
TheWanderer
TheWanderer
fatal error C1083: Cannot open include file: 'Ogre.h': No such file or directory

And it is being thrown while compiling the Demo. The engine project compiles just fine. It could probably be solved by adding an "Additional include paths", but why should I have to do so in the Demo when it is not accessed directly from there. That functionality is hidden (or SHOULD be hidden) behind the engin interface.
Aardvajk
Aardvajk
I'd guess that you must be including ogre.h in the header file associated with your .lib file that you are including in your demo project. You are correct in that if this header had just been referenced when the .lib was compiled, it would not be needed for the demo compilation.

Does the header file for you lib reference any Ogre types or whatever?
TheWanderer
TheWanderer
Well, the Demo includes Engine.h, which includes OgreGfx.h (an class which encapsulates Ogre), which is the one which include Ogre.h. So, indirectly (VERY indirectly), I am including Ogre.h. How do I address that though?
ToohrVyk
ToohrVyk
1° Set up your include paths so your project can include Ogre as well

or

2° Isolate your project from Ogre, by not exposing any Ogre functionality in the library headers. See also the pimpl idiom.

Topic Locked

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

Sign in to reply to this topic.