Allocator - OK but...
Jan Mannekens
Jan.Mannekens@alcatel.be
Fri Jun 29 05:27:00 GMT 2001
Hi all,
I've got a bunch of code and in stead of using the std::string I use my
own string 'y_string', which is defined as follows. I use my own
specific stringAllocator class (see below) as allocator for this
y_string:
#include <std/bastring.h>
#include "alloc.h"
class y_stringAllocator {
public:
static void * allocate(size_t n);
static void deallocate(void *p, size_t n);
static void *reallocate(void *p, size_t old_sz, size_t new_sz);
static void getStatistics(y_uint32 * nbrstrings, y_uint32
*nbrbytes);
};
typedef basic_string<char, string_char_traits<char>,
y_stringAllocator> y_string;
On Linux everything works fine. On DEC Alpha XP900 with gcc version
2.95.3 I get no problems compiling this into a libstring.a library, but
when it comes to finally linking everything together I get:
/usr/bin/ld:
Unresolved:
basic_string<char, string_char_traits<char>,
y_stringAllocator>::nilRep
collect2: ld returned 1 exit status
The libraries I link with are:
-lrt -lm -lc -lstdc++ -lstring -lstdc++
Any ideas?
Thanks in advance,
Jan Mannekens
More information about the Gcc-help
mailing list