S
Stevenmbiz
Guest
I'm using managed c++/cli to wrap a C++ class with a static string member to save current project directory location, like the following:
namespace Core {
class Application {
public:
static string ProjectPath;
…
}
}
and I've initialized it at the top of the cpp file:
string Application:rojectPath = "D:\Documents\Path";
When trying to access this static var in my cli wrapper class, like the following:
namespace Wrapper {
...
void Application:rojectPath::set(String^ path) {
Core::Application:rojectPath = to_string(path); // <-- cause a link error!
...
}
it caused 2 link errors said: error LNK2020: unresolved token (0A000BBD) "public: static char const *
and error LNK2001: unresolved external symbol.
Any clue for this?
Continue reading...
namespace Core {
class Application {
public:
static string ProjectPath;
…
}
}
and I've initialized it at the top of the cpp file:
string Application:rojectPath = "D:\Documents\Path";
When trying to access this static var in my cli wrapper class, like the following:
namespace Wrapper {
...
void Application:rojectPath::set(String^ path) {
Core::Application:rojectPath = to_string(path); // <-- cause a link error!
...
}
it caused 2 link errors said: error LNK2020: unresolved token (0A000BBD) "public: static char const *
and error LNK2001: unresolved external symbol.
Any clue for this?
Continue reading...