C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Undefined static variable in std::string

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
Aniket Kulkarni
Guest





PostPosted: Mon Apr 19, 2004 9:56 am    Post subject: Undefined static variable in std::string Reply with quote



Hi,

While performing the final link stage for my application (platform
HPUX, using gcc 3.2) I got the following errors:

/usr/ccs/bin/ld: Unsatisfied symbols
std::basic_string<char, std::char_traits std::__allocator<char, rc:tlAlloc<(int)56555, (int)1219> >
Quote:
::_Rep::_S_max_size(data)
std::basic_string<char, std::char_traits

std::__allocator<char, rc:tlAlloc<(int)56555, (int)1219> >
Quote:
::_Rep::_S_terminal(data)
collect2: ld returned 1 exit status


On investigation I found out that a certain .o file has the above
symbols undefined, and the error seems to be due to a typedef as
follows:

typedef basic_string<char, char_traits std::__allocator<char, MyAlloc> > String;

(NOTE: MyAlloc is an SGI style allocator and I am using the
__allocator to convert the same to STL style allocator)

In whichever .o files, the aforementioned String is used, the above
symbols are undefined. The errors go away if I don't specify my own
allocator and just use the standard string

typedef string String;

What could be the problem and how could that be solved (without the
"typdef string String" solution, because I'd rather use my Allocator).

Thanks in advance,
~ aniket

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Dave Moore
Guest





PostPosted: Tue Apr 20, 2004 10:25 am    Post subject: Re: Undefined static variable in std::string Reply with quote



[email]aniket_s_kulkarni (AT) hotmail (DOT) com[/email] (Aniket Kulkarni) wrote in message news:<b8be7c99.0404182229.f96d5ea (AT) posting (DOT) google.com>...
Quote:
Hi,

While performing the final link stage for my application (platform
HPUX, using gcc 3.2) I got the following errors:

/usr/ccs/bin/ld: Unsatisfied symbols
std::basic_string<char, std::char_traits std::__allocator<char, rc:tlAlloc<(int)56555, (int)1219
::_Rep::_S_max_size(data)
std::basic_string std::__allocator<char, rc:tlAlloc<(int)56555, (int)1219
::_Rep::_S_terminal(data)
collect2: ld returned 1 exit status

On investigation I found out that a certain .o file has the above
symbols undefined, and the error seems to be due to a typedef as
follows:

typedef basic_string std::__allocator<char, MyAlloc> > String;

(NOTE: MyAlloc is an SGI style allocator and I am using the
__allocator to convert the same to STL style allocator)

In whichever .o files, the aforementioned String is used, the above
symbols are undefined. The errors go away if I don't specify my own
allocator and just use the standard string

typedef string String;

What could be the problem and how could that be solved (without the
"typdef string String" solution, because I'd rather use my Allocator).

Thanks in advance,
~ aniket


Yikes! .. it seems you are hacking pretty deep into the library here
.... in my experience those are linker-error-infested waters.

I'd say that you didn't define some static variables that are
implicitly declared by the String typedef using your allocator
implementation .. but its hard to tell without the code. I expect
that you will need to carefully read the header file providing
std::basic_string to your compiler's STL implementation, and then
figure out how to properly instantiate the missing static variables
using your allocator type.

I don't envy you, but good luck!

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.