Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old March 15th, 2006, 07:05 AM
Madni
Guest
 
Posts: n/a
Default using maps errors

Hi,

WHile iam trying to build my project holding a class carrying map (STL)
as a static data member the following link2001 error is reported .:

WESFWDeviceManager error LNK2001: unresolved external symbol "private:
static class std::map<class std::basic_string<unsigned short,struct
std::char_traits<unsigned short>,class std::allocator<unsigned short>[color=blue]
>,unsigned long,struct std::less<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > >,class std::allocator<struct std::pair<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const ,unsigned long> > > CDeviceLicenseMgr::m_mapDriversCount" (?m_mapDriversCount@CDeviceLicenseMgr@@0V?$map@V?$ basic_string@GU?$char_traits@G@std@@V?$allocator@G @2@@std@@KU?$less@V?$basic_string@GU?$char_traits@ G@std@@V?$allocator@G@2@@std@@@2@V?$allocator@U?$p air@$$CBV?$basic_string@GU?$char_traits@G@std@@V?$ allocator@G@2@@std@@K@std@@@2@@std@@A)[/color]


any one plz help me in this

Regards ,
Madni

  #2  
Old March 15th, 2006, 07:25 AM
Mathias Waack
Guest
 
Posts: n/a
Default Re: using maps errors

Madni wrote:
[color=blue]
> Hi,
>
> WHile iam trying to build my project holding a class carrying map (STL)
> as a static data member the following link2001 error is reported .:
>
> WESFWDeviceManager error LNK2001: unresolved external symbol "private:
> static class std::map<class std::basic_string<unsigned short,struct
> std::char_traits<unsigned short>,class std::allocator<unsigned short>[color=green]
>>,unsigned long,struct std::less<class std::basic_string<unsigned
>>short,struct std::char_traits<unsigned short>,class
>>std::allocator<unsigned short> > >,class std::allocator<struct
>>std::pair<class std::basic_string<unsigned short,struct
>>std::char_traits<unsigned short>,class std::allocator<unsigned short> >
>>const ,unsigned long> > > CDeviceLicenseMgr::m_mapDriversCount"
>>(?m_mapDriversCount@CDeviceLicenseMgr@@0V?$map@V ?$basic_string@GU[/color][/color]
$char_traits@G@std@@V?$allocator@G@2@@std@@KU?$les s@V?$basic_string@GU
$char_traits@G@std@@V?$allocator@G@2@@std@@@2@V?$a llocator@U?$pair@$$CBV
$basic_string@GU?$char_traits@G@std@@V
$allocator@G@2@@std@@K@std@@@2@@std@@A)[color=blue]
>
>
> any one plz help me in this[/color]

Not really - without seeing any code I can only guess. But maybe its worth
reading FAQ 10.11. at http://www.parashift.com/c++-faq-lite.

Mathias
  #3  
Old March 15th, 2006, 07:45 AM
Sunil Varma
Guest
 
Posts: n/a
Default Re: using maps errors


Madni wrote:[color=blue]
> Hi,
>
> WHile iam trying to build my project holding a class carrying map (STL)
> as a static data member the following link2001 error is reported .:
>
> WESFWDeviceManager error LNK2001: unresolved external symbol "private:
> static class std::map<class std::basic_string<unsigned short,struct
> std::char_traits<unsigned short>,class std::allocator<unsigned short>[color=green]
> >,unsigned long,struct std::less<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > >,class std::allocator<struct std::pair<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const ,unsigned long> > > CDeviceLicenseMgr::m_mapDriversCount" (?m_mapDriversCount@CDeviceLicenseMgr@@0V?$map@V?$ basic_string@GU?$char_traits@G@std@@V?$allocator@G @2@@std@@KU?$less@V?$basic_string@GU?$char_traits@ G@std@@V?$allocator@G@2@@std@@@2@V?$allocator@U?$p air@$$CBV?$basic_string@GU?$char_traits@G@std@@V?$ allocator@G@2@@std@@K@std@@@2@@std@@A)[/color]
>
>
> any one plz help me in this
>
> Regards ,
> Madni[/color]

Seems you have not defined the map object globally.
Could you post the code you are getting error so that we can look into
furthur.

  #4  
Old March 15th, 2006, 07:45 AM
Madni
Guest
 
Posts: n/a
Default Re: using maps errors

thanks for reply .... yes my map object is not declared globally rather
its a static data member ... i wonder if i could use map as a static
member as i have never use it like before ... any ways following is a
header file carrying the map object declaration and its use ....
WESString is a wrapper class

#include <MAP>
using namespace std;

typedef map<WESString,DWORD>::iterator MAPITR;
class CDeviceLicenseMgr
{
public:
CDeviceLicenseMgr(void);
virtual ~CDeviceLicenseMgr(void);

inline static DWORD getActiveDAClientCount (WESString wstrDriverName)
{
CSQSCriticalSectionGuard cs(m_cs);
MAPITR itr = m_mapDriversCount.find(wstrDriverName);
if(itr != m_mapDriversCount.end()) // if driver is there
{
return itr->second;

}

return 0; // driver not found
}

inline static void setActiveDAClientCount (WESString wstrDriverName,
DWORD dwCount)
{
CSQSCriticalSectionGuard cs(m_cs);
MAPITR itr = m_mapDriversCount.find(wstrDriverName);
if(itr != m_mapDriversCount.end())
{
itr->second = dwCount;
}

}

inline static void incrementActiveDAClientCount (WESString
wstrDriverName)
{
CSQSCriticalSectionGuard cs(m_cs);
MAPITR itr = m_mapDriversCount.find(wstrDriverName);
if(itr != m_mapDriversCount.end()) // if driver name is in the map
{
DWORD temp = itr->second;
temp++;
itr->second = temp;
}
else // add driver name in the map and initialize count to 1
{
m_mapDriversCount.insert(make_pair(wstrDriverName, 1));
}
}

inline static void decrementActiveDAClientCount (WESString
wstrDriverName)
{
CSQSCriticalSectionGuard cs(m_cs);
MAPITR itr = m_mapDriversCount.find(wstrDriverName);
if(itr != m_mapDriversCount.end())
{
DWORD temp = itr->second;
temp--;
itr->second = temp;
}
//dwActiveDAClientCount-- ; find driver in map and decrement
accordingly
}

static bool validateActiveDAClientCountLicense(WESString
wstrDriverName);
static HRESULT validateLicenseForNewActiveDAClient(const WESContext
&a_wcx, WESString wstrDriverName);
static void updateLicenseForDeleteActiveDAClient(const WESContext
&a_wcx, WESString wstrDriverName);

private:
static DWORD dwExternalDAClientCount;
static DWORD dwActiveDAClientCount;
static CSQSCriticalSection m_cs;
static map<WESString,DWORD> m_mapDriversCount;

};

  #5  
Old March 15th, 2006, 08:25 AM
Madni
Guest
 
Posts: n/a
Default Re: using maps errors

i've figured out the problem ...on the top of the DeviceLicenseMgr.cpp
i should put the line :
map<WESString,DWORD> CDeviceLicenseMgr::m_mapDriversCount;

this resolves the issue ,.... thanks all u guys for ur positive replies
...

Madni

 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles