Re: Need help with compiling C++ program
You can define macros at compile time with the -D option to g++:
This is the same as doing a #define in your program:
g++ -o myprogram -DANSWER=42 myprogram.cc
The value on the command line doesn't have to be a constant, it could be the output of a program:
The quoting gets a bit messy with strings.
g++ -o myprogram -DDATE="\"$(date)\"" myprogram.cc
Please create new threads for new questions.
Please wrap code in code tags using the '#' button or enter it in your post like this: [code]...[/code].