P
Paul N
I'm getting in knots trying to declare a header, and it's to do with a
typedef. First, an example. If I do this:
struct realname;
void fun(realname& val);
struct realname { int val; };
then this compiles fine. (It doesn't link, of course.) If the compiler
knows that realname is a struct it is perfectly happy to let me
declare a function taking a reference to one, even if it doesn't yet
know what's in the struct.
But if I do this:
struct fakename;
void fun(fakename& val);
struct realname { int val; };
typedef realname fakename;
it doesn't compile. Am I just getting the syntax wrong or is it
fundamentally impossible?
My actual problem is that I want to have a header which declares some
functions that take a reference to a OPENFILENAME struct. OPENFILENAME
is defined in non-standard system header <commdlg.h>, but it's defined
via two typedefs. Is there any way I can create a header containing
lines like:
void fileinit(OPENFILENAME& fileopenstruct, HWND owner);
without needing to always include commdlg.h before my own header?
Many thanks.
Paul.
typedef. First, an example. If I do this:
struct realname;
void fun(realname& val);
struct realname { int val; };
then this compiles fine. (It doesn't link, of course.) If the compiler
knows that realname is a struct it is perfectly happy to let me
declare a function taking a reference to one, even if it doesn't yet
know what's in the struct.
But if I do this:
struct fakename;
void fun(fakename& val);
struct realname { int val; };
typedef realname fakename;
it doesn't compile. Am I just getting the syntax wrong or is it
fundamentally impossible?
My actual problem is that I want to have a header which declares some
functions that take a reference to a OPENFILENAME struct. OPENFILENAME
is defined in non-standard system header <commdlg.h>, but it's defined
via two typedefs. Is there any way I can create a header containing
lines like:
void fileinit(OPENFILENAME& fileopenstruct, HWND owner);
without needing to always include commdlg.h before my own header?
Many thanks.
Paul.