I have a static library written in C ++, and I have a structure describing the data format, i.e.
struct Format{
long fmtId;
long dataChunkSize;
long headerSize;
Format(long, long, long);
bool operator==(Format const & other) const;
};
Some data formats are widely used, for example, {fmtId=0, dataChunkSize=128, headerSize=0}and {fmtId=0, dataChunkSize=256, headerSize=0}
Some data structure classes get the format in the constructor. I would like to have some shortcuts for those commonly used formats, like a pair of global Formatmembers gFmt128, gFmt256that I can pass by reference. I create them in a .cpp file, for example
Format gFmt128(0, 128, 0);
and in .h there
extern Format gFmt128;
I also declare Format const & Format::Fmt128(){return gFmt128;}and try to use it in the main module.
But if I try to do this in the main module that uses lib, the linker complains about unresolved external ones gFmt128.
"" , ?