G
Guest
I had two Visual Studio .NET C++ solutions that I combined into one. These
project solutions were very similar. In fact, the two solutions were sharing
many files.
Now that they are one solution, I #ifdef'd pre-processor variables
throughout the code that will compile the code differently. The solution
needs to be #define'd differently depending on which computer I compile it
on:
#define COMPUTER1
//#define COMPUTER2 // comment out above and uncomment this when
compiling on COMPUTER2
....
#ifdef COMPUTER1
.... code specific for COMPUTER1
#endif
#ifdef COMPUTER2
... code specific for COMPUTER2
#endif
My question: Instead of having a "#define COMPUTER1", how can I use an
environment variable (or something similar) that the compiler can use to
determine what computer the program is being compiled on?
Something like:
[assume an environment variable called COMPUTER_NAME which is = "COMPUTER1"
or "COMPUTER2"]
#ifdef GET_ENVIRONMENT_VAR(COMPUTER_NAME)
.... "GET_ENVIRONMENT_VAR()" translates to "COMPUTER1" or "COMPUTER2"
....
?
project solutions were very similar. In fact, the two solutions were sharing
many files.
Now that they are one solution, I #ifdef'd pre-processor variables
throughout the code that will compile the code differently. The solution
needs to be #define'd differently depending on which computer I compile it
on:
#define COMPUTER1
//#define COMPUTER2 // comment out above and uncomment this when
compiling on COMPUTER2
....
#ifdef COMPUTER1
.... code specific for COMPUTER1
#endif
#ifdef COMPUTER2
... code specific for COMPUTER2
#endif
My question: Instead of having a "#define COMPUTER1", how can I use an
environment variable (or something similar) that the compiler can use to
determine what computer the program is being compiled on?
Something like:
[assume an environment variable called COMPUTER_NAME which is = "COMPUTER1"
or "COMPUTER2"]
#ifdef GET_ENVIRONMENT_VAR(COMPUTER_NAME)
.... "GET_ENVIRONMENT_VAR()" translates to "COMPUTER1" or "COMPUTER2"
....
?