I want to be able to access an environment variable to control how a program is compiled.
So:
export MY_VERSN=9
Then ideally, within my C++ code, I would have
#if MY_VERSN = 9
iret = FRED9()
#else
iret = FRED()
#endif
The way I thought I could do it is that in the script that sets up the environmental variable MY_VERSN (which I need in any case) , I could also create an include file fred.h containing
#define MY_VERSN 9
and then include fred.h in my C++ code.
I think that my requirement to conditionally compile based on an env variable must be a common one; so I'd be grateful for sugestions on how it is usually achieved. Thanks