| zydgyy (2) | |
|
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; } | |
|
|
|
| Aceix (455) | |
|
#include "Test.h" in Test.cpp. Hope it helps, Aceix. | |
|
|
|
| guestgulkan (2831) | |
|
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
|
|