Are they defined in .cpp file as well? Roughly, it should look like:
struct Format
{
[...]
static Format gFmt128;
};
// Format.cpp
Format Format::gFmt128 = { 0, 128, 0 }
Are they defined in .cpp file as well? Roughly, it should look like:
struct Format
{
[...]
static Format gFmt128;
};
// Format.cpp
Format Format::gFmt128 = { 0, 128, 0 }
Don't use the static keyword on global declarations. Here is an article explain the visibility of variables with/without static. The static gives globals internal linkage, that is, only visible in the translation unit they are declared in.
Skizz
Morhveus, I tried this out, too. My linker rather says it has the gFmt128 symbol already defined. This is indeed the behaviour I would expect: the compiler adds the function body to both the library and the client object since it's defined in the include file.
The only way I get unresolved externals is by
I'm puzzled... How come we see something different? Can you explain what happens?