For example
Dlg1.cpp has
struct blah {
int x;
};
and I need Dlg2.cpp to access that struct but I can't get it to work. Any help?
I'm creating a C++ program using mainly dialogs, and I want to make a global struct so that all files can use.
Here's the tried-and-true way to do it in C. There may be a more C++-like technique.
(1) Create a header file, such as blah.h, and put this in the header:
extern struct blah {
int x;
}
(2) Include that header in both Dlg1.cpp and Dlg2.cpp.
(3) Retain the existing definition of blah (without the extern) in Dlg1.cpp.
flowers for algernon
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment