It seems you want to use different headers depending on some "compilation profile".
Instead of the -D solution, I would prefer to use the -I directive to specify include directories.
Given that you have the following file tree:
/ debug/ header.h release/ header.h
main.cpp :
#include "header.h"
And in your Makefile (or any other tool that you use) just specify the appropriate include directory , depending on whatever reason you want:
g++ -I debug main.cpp // Debug mode g++ -I release main.cpp // Release mode
Important note: I do not know if you plan to use this as a debug / release switch. However, doing this would be strange: the interface (the included .h files) should not change between release and debug . If you ever need it, the usual way is to enable / disable parts of the code using definitions, mainly in .c (and .cpp ) files.
ereOn source share