I have three closely related applications that are built from the same source code - say, APP_A, APP_B and APP_C. APP_C is a superset of APP_B, which, in turn, is a superset of APP_A.
So far, I have used the definition of a preprocessor to indicate which application to create, which works as follows.
// File: app_defines.h
IDE build options then indicate (for example)
#define APPLICATION APP_B
... and in the source code I will have things like
#include "app_defines.h" #if APPLICATION >= APP_B
However, I shot myself in the foot this morning and spent a lot of time just dropping the line #include "app_defines.h" from one file. Everything compiled in order, but the application crashes with AVs when loading.
I would like to know what is the best way to handle this. This used to be one of the few times when I could consider using #define (anyway, in C ++), but I'm still not good at it, and the compiler did not protect me.
c ++ c-preprocessor configuration-management software-product-lines
Roddy
source share