Re: Question about Leverage source from Different Projects



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.

"Danny" <fernandez.dan@xxxxxxxxx> wrote in message
news:1170805739.995281.240610@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I am trying to leverage source from a different MFC projects. I
haven't tried this before I am running into issues. I'm include the
desired source but I am having issues with the stdafx.h. In this
simple example say I have the following directories
c:\LeveragedMfcProject
c:\MfcProject

The approach I am taking is in the MfcProject source is that
1) Project --> Add Existing Item I chose LeveragedSource.h and
LeveragedSource.cpp in the LeveragedMfcProject

2) In source that wants to use I include source like this
#include "..\LeveragedSource.h"


But I am getting errors about stdafx.h fie for LeveragedSource which
contains #include "stdafx.h" in the cpp file.

Do I need to include the stdafx.h in the LeveragedMfcProject in my
MfcProject in order for this approach to work?

Hopefully I am making sense. I appreciate any advice or references for
including source from multiple projects.

Thanks

Danny



.