Yes it is indeed MFC related, but I was trying to be vague to protect myself from the "THIS IS NOT A MFC FORUM" or "eww MFC" crowd, but I guess I might as well post my problem in more detail in hopes of a EUREKA moment.
1) I have a dialog that I would like to include in multiple projects.
2) This dialog obviously consists of a header & a .cpp implementing the dialog.
3) Rather than make copies of this implementation and include them in the multiple projects I want to put the implementation for the dialog in a neutral common folder unrelated to any project and include/add them to both projects.
Now, the dialog resource itself will be duped (no getting around that) it will have to be in both project's "Resource.h" & "Resource.rc" file (all the defines for the controls, the dialog, etc), but I don't consider this a big deal as the dialog will never change (buttons, controls, etc all will remain the same).
However, the implementation of the dialog will change, thus the desire to have it shared between projects so as to only have to modify it once. The problem is the dialog's implementation files need the #defines in the project's "Resource.h" to which it is being used in. The way I am doing it now is:
Code:
(in the shared dialogs header)
#ifdef PROJECT_1
#include "..\..\Project1\Resource.h"
#elif PROJECT_2
#include "..\..\Project2\Resource.h"
#endif
class MyDialog : public CDialog{
enum {IDD = IDD_DIALOG}; <-- IDD_DIALOG defined projects in Resource.h.
};
This works, but what bothers me is I have someone else's project that faces the exact same thing I'm trying to do (include a neutral dialog's implementation), but unlike mine theirs doesn't complain about undefined #define variables and compiles/builds/and runs. In their files they make no reference to a "Resource.h" anywhere and doesn't include a header that somewhere down the line includes a "Resource.h" or any file specifying these required defines...nowhere! And their project settings are identical to mine... it has me slightly baffled as to why their project compiles (and recognizes the defines in the Resource.h) while mine doesn't. Anyone have an idea?
P.S. I would share the project that actually compiles and mine that doesn't, but they are huge and rather confidential...
Code:
(Example of their shared dialog's header)
// They aren't including any "Resource.h" here.. no headers that ever reference a "Resource.h" or any file that #define IDD_DIALOG yet their project builds fine..
class MyDialog : public CDialog{
enum {IDD = IDD_DIALOG}; <-- IDD_DIALOG defined in projects Resource.h.
};