about vs2012 and class static member

In my solution there are two projects,one is used as dll project,and one is client.
in my dll a class has a class static member,and i initilize it in .cpp file.
but i use this class static member in client project,it issue LINK error: fatal error LNK1120:

project dll:
Test.h:::::::::::::::::
class Test
{
public:
static const int var;
};
Test.cpp:::::::::::::::
const int Test::var = 1;

and project client:
#include "Test.h"
void main ()
{
std::cout<<Test::var;
}
#include "Test.h" in Test.cpp.

Hope it helps,
Aceix.
In addition to what what Aceix said - You will have to EXPORT the static variable from the DLL

EDIT - Add link
http://msdn.microsoft.com/en-us/library/81h27t8c%28v=vs.80%29.aspx
Last edited on
Topic archived. No new replies allowed.