I have a project with a bunch of different options that you can turn on and off sprinkled throughout many files. You comment and uncomment the options you want, much like the php.ini file in PHP file, though this is actual code. It looks something like this:
//#ifndef _OPTION_1
//#define _OPTION_1
//#endif
#ifndef _OPTION_2
#define _OPTION_2
#endif
int menu()
{
#ifdef _OPTION_1
cout << "Option 1\n";
#endif
#ifdef _OPTION_2
cout << "Option 2\n";
#endif
cout << "Pick an option : ";
// code for picking an option, quitting, etc.
}
int main()
{
int option;
while(option = menu())
{
// code here for implementing options
}
return 0;
}
That's the idea, though with many, many options in many files and directories.
The pre-processor turns it into this:
int menu()
{
cout << "Option 2\n";
cout << "Pick an option : ";
// code for picking an option, quitting, etc.
}
int main()
{
int option;
while(option = menu())
{
// code here for implementing options
}
return 0;
}
I'm getting a headache looking at the raw code with all the #define statements in it, so I'd rather look at the second version than the first. I'm looking for either a gcc/g++ compiler option that spits out the code with the #defines parsed/removed or some program that's already written that does that that I can just run. As a last resort, I suppose I can write one myself, but I'm hoping there's one that's already written. Can anyone guide me in the right direction?