Re: Question about Leverage source from Different Projects
- From: "Scot T Brennecke" <ScotB@xxxxxxxxxxxxxxxxxx>
- Date: Tue, 6 Feb 2007 23:37:47 -0600
<slapping self> Even if it would have compiled, by suggestion wouldn't work, since I didn't take
into account the relative path of stdafx.h.
I've done similar things in the past with conditionally including headers depending on the project,
and I just carelessly assumed I knew what I was talking about here.
However, I guess one could create a stdafx.h in the directory with the shared .cpp and put all that
conditional preprocessor stuff INSIDE the stdafx.h depending on the project macro defined.
"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
news:gpmis2lvv46cedu33rqlib5cmmhnlqp836@xxxxxxxxxx
That actually won't work. For example, everything up to
#include "stdafx.h"
is treated as a syntactically ill-formed comment. So the #if is not seen, nor is the
#pragma, but the #elif will be seen and complain that it is unmatched.
I've done this a lot of times and never had a problem with the use of stdafx.h in the
files I'm including from another project. I'm not even sure I understand why the issue
arises.
There is, as far as I can tell, not even a discussion of the .cpp files, just a strange
comment that there is a problem, but nothing prior to this suggests that there should be a
problem.
I have many projects which have shared source and shared include directories, and I just
include the source files from the source directories and the header files from the include
directory and it all works.
joe
On Tue, 6 Feb 2007 22:23:34 -0600, "Scot T Brennecke" <ScotB@xxxxxxxxxxxxxxxxxx> wrote:
If you have one project that uses the precompiled headers and another one that doesn't, you can
use
preprocessor directives to determine whether or not to #include "StdAfx.H" in the .cpp For
instance:
#if defined(__MFCPROJECT__)
#pragma message("Building MfcProject")
#include "StdAfx.H"
#elif defined(__LEVERAGEDMFCPROJECT__)
#pragma message("Building LeveragedMfcProject")
#endif
To make this work, just add those macros to your project preprocessor defines.
.
- References:
- Question about Leverage source from Different Projects
- From: Danny
- Re: Question about Leverage source from Different Projects
- From: Scot T Brennecke
- Re: Question about Leverage source from Different Projects
- From: Joseph M . Newcomer
- Question about Leverage source from Different Projects
- Prev by Date: Re: Escape key
- Next by Date: Re: Problem with modal dialogs
- Previous by thread: Re: Question about Leverage source from Different Projects
- Next by thread: Re: Question about Leverage source from Different Projects
- Index(es):
Relevant Pages
|