L
linq936
Hi,
I have some code like this,
h1.h:
class H1{
public:
const static string myStr;
};
h1.c:
#include "h1.h"
const string H1::myStr = "some string";
The 2 files, h1.h and h1.c are in one library, h1.lib.
Then I have this file in another library,h2.lib,
h2.c
#include "h1.h"
int r = some_function(H1::myStr);
In linking h2.lib I can see from the linking command that h1.lib is
linked, but I still get this link error,
h2.obj : error LNK2001: unresolved external symbol "public: static
class string const H1::myStr" (?myStr@H1@@2V?$string@D@@B)
Do you see what is wrong?
I have some code like this,
h1.h:
class H1{
public:
const static string myStr;
};
h1.c:
#include "h1.h"
const string H1::myStr = "some string";
The 2 files, h1.h and h1.c are in one library, h1.lib.
Then I have this file in another library,h2.lib,
h2.c
#include "h1.h"
int r = some_function(H1::myStr);
In linking h2.lib I can see from the linking command that h1.lib is
linked, but I still get this link error,
h2.obj : error LNK2001: unresolved external symbol "public: static
class string const H1::myStr" (?myStr@H1@@2V?$string@D@@B)
Do you see what is wrong?