Original Post
Ive created a small library for my own graphical file format using a CPP file (really C code) and a header file used for both compiling the cpp file, and for the program linking to the LIB file.
I compile the lib using "c:\Lib MyGFX.obj".
My problem is, when I compile my program that links to the LIB file, the compile halts when compiling LIB''s header file, saying
"struct re-definition" or something.
The cpp file contains a struct for its own use, some #define''s and a few functions, both for internal use and for external access.
//The h file contains a struct for the file format like as so..
typedef struct MyGFX
{
int etc..
} MYGFX;
//There is a function declaration in the .h as well..
MYGFX *Get_PointerToFile();
// This compiles ok, and I create the lib file ok.
// But compiling other programs using the .lib and .h is
// where my prob is.
Is this ok to do, or should I have two seperate header files?
And, if I have two header files, should I put a copy of the struct in both headers, or just in the original?
And say if I had a function declared in the second header file using the structs name, how do I reference it?
Something like "extern struct MYGFX"
for function MYGFX *GetPointerToFile();