I would like to override a macro from the command line. Somewhere in my source, there is a definition like this:
#define MY_FOO 1
What I wo
If the file config.h prevents multiple inclusions (via #ifndef CONFIG_H etc), then you could abuse that:
g++ -DMY_FOO=2 -DCONFIG_H
Note: If the file config.h contains anything else that you need, then you have to define that yourself again as well. You could make a copy of the file as my_config.h and include that. (See also the -include file
preprocessor option).