I'm learning C++ from Thinking in C++ by Eckel. I'm trying to solve an exercise problem. Here is the first part:
Write a program with conditionally-compiled code in main( ), so that when a preprocessor value is defined one message is printed, but when it is not defined another message is printed. Compile this code experimenting with a #define within the program. My solution: #include <iostream> using std::cout; using std::endl; int main() { //#define PI 3.14159 #ifdef PI cout << "PI is defined." << endl; #endif #ifndef PI cout << "PI is not defined." << endl; #endif } Then: Then discover the way your compiler takes preprocessor definitions on the command line and experiment with that. How can I create preprocessor definitions on the command line? I was look at the man pages, but all I found was an option for macros. Are there docs for g++ that are easier to use than the man pages? _______________________________________________ Help-gplusplus mailing list Help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus