|
From:
<ind...@gm...> - 2005-09-23 14:41:57
|
Dear Bhadram,
I am writing to you in response to your mail to the Dev-C++ user list.
> Dear friends,
> I'd problem in vc++. The problem is i want to call the static
> method of a class in another header file. But if im calling it is giving
> linking error
> error LNK2001: unresolved external symbol
> [...] (rest of mail left out because of its longitude)
the problem you encountered is due to the fact that in this case, the
_word_map member of the class UserQuery is just the declaration, not the
definition.
The solution to that would be to create a new file, UserQuery.cpp, and
include following lines:
UserQuery.cpp:
#include "UserQuery.h"
map<string,vector<Location>*,less<string> >* UserQuery::_word_map = 0;
You could even leave out the '= 0', the only important thing is that
the symbol _word_map is DEFINED in a COMPILATION MODULE (which a
header file is not).
Hope that helps,
Yours,
David.
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.5/110 - Release Date: 22.09.2005
|