Skip to main content
GameDev.net gamedev.net
🔒 Locked

Creating a LIB file...

Started by SikCiv Jul 3, 2000 at 1:34 AM 0 replies 300+ views
Original Post
SikCiv
SikCiv
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();
  Downloads:  ZeroOne Realm
GayleSaver
GayleSaver
quote:
Original post by SikCiv



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.



Try defining internal structures in the CPP file.
VK

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.