 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Aniket Kulkarni Guest
|
Posted: Mon Apr 19, 2004 9:56 am Post subject: Undefined static variable in std::string |
|
|
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
|
Posted: Tue Apr 20, 2004 10:25 am Post subject: Re: Undefined static variable in std::string |
|
|
[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 |
|
 |
|
|
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
|
|