MSVC 2010 C++ Project-dependent code

Hello.

I have one solution with 2 projects inside.
These 2 projects share some cpp and h files.
I'd like to have the same files parsed differently depending on which project is currently being compiled.
Example:

1
2
3
4
5
#ifdef COMPILING_PROJECT_1_RIGHT_NOW
#define SOMEMACRO(arg) FUNCTION_A(arg)
#elifdef COMPILING_PROJECT_2_RIGHT_NOW
#define SOMEMACRO(arg) FUNCTION_B(arg)
#endif 


Asking because I have to deal with an ugly SDK here.
The other solution is to make a copy of the file, but
I'd first like to see whether there already is an
implementation for this.
Last edited on
Goto preprocessor from project1 properties, create PROJECT1_CHECK

Goto Preprocessor from Project2 properties, create PROJECT2_CHECK

example,

1
2
3
4
5
#ifdef PROJECT1_CHECK
 #define FUNA(arg) CommonFunc(arg)
#elifdef PROJECT2_CHECK
 #define FUNB(arg) CommonFunc(arg)
#endif 



Hopes this helps you.
That looks exactly like what I need. Thanks. I will try this when I get the time. Exams make busy.
Topic archived. No new replies allowed.