inconsistent dll linkage & definition of dllimport static data member not allowed
Assuming I have these two files: Header.h class DLL ExportClass{ public: ExportClass(); static int test; }; Source.cpp #ifdef EXPORT #define DLL __declspec(dllexport) #else #define DLL __declspec(dllimport) #endif #include "Header.h" int ExportClass::test = 0; ExportClass::ExportClass(){ } And I won't define EXPORT (to import a already exported class with a static member), why do I get these warnings: 1>source.cpp(11): warning C4273: 'test' : inconsistent dll linkage 1> header.h(4) : see previous definition of 'public: static int ExportClass::test' 1>source.cpp(13): warning C4273: 'ExportClass