Jump to content
  • Advertisement
Sign in to follow this  

Precompiled Headers...

This topic is 3273 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

1. I have a multiple project solution. 2. One solution contains pre-compiled headers (PCH) and one doesn't. 3. I have a .h/.cpp which I want to include in both projects. I currently have the following code at the top of my .cpp

#ifndef FBX_TO_BINARY


#include "GraphicsPrecompiled.h"
#include "../GraphicsInclude.h"

#else

#include "NewModelFuncs.h"

#endif


This is not working and giving the following errors.. 1>.\NewModelFuncs\NewModelFuncs.cpp(7) : fatal error C1019: unexpected #else Is it even possible to do this and if so, how? Thanks, stringa

Share this post


Link to post
Share on other sites
Advertisement
NM....I figured it out.


I my second project "NOT USING PRECOMPILED" I just included a dummy file that has the same and a relative path as the precompiled.

Walla....It works.

I'm not 100% sure why it doesn't work with MACRO defines, but this way seems to do it.

Share this post


Link to post
Share on other sites
When a file is set to compile using precompiled headers, the compiler ignores everything before that include.

As a result, your 'using precompiled headers' case looked like this to the compiler:


#include "GraphicsPrecompiled.h"
#include "../GraphicsInclude.h"

#else

#include "NewModelFuncs.h"

#endif


...which obviously isn't valid.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!