STL & basic_string<XMLCh> link error

  • Thread starter =?ISO-8859-15?Q?R=E9mi_Peyronnet?=
  • Start date
?

=?ISO-8859-15?Q?R=E9mi_Peyronnet?=

Hello,

I have some link problems while using basic_string with another type
(unsigned int in my case)

This is a sample source :

"

#include <string>

using namespace std;

typedef unsigned int XMLCh;

typedef basic_string<XMLCh> xmlstring;

int main()
{
xmlstring str;
str = (XMLCh)'T';
return 0;
}

"

I get many error of this kind :
"
: undefined reference to `std::char_traits<unsigned>::assign(unsigned*,
unsigned, unsigned)'
/tmp/cckF0b4s.o(.gnu.linkonce.t._ZNSbIjSt11char_traitsIjESaIjEE9_M_mutateEjjj+0x147):
In function `std::basic_string<unsigned, std::char_traits<unsigned>,
std::allocator<unsigned> >::_M_mutate(unsigned, unsigned, unsigned)':
: undefined reference to `std::char_traits<unsigned>::copy(unsigned*,
unsigned const*, unsigned)'
/tmp/cckF0b4s.o(.gnu.linkonce.t._ZNSbIjSt11char_traitsIjESaIjEE9_M_mutateEjjj+0x182):
In function `std::basic_string<unsigned, std::char_traits<unsigned>,
std::allocator<unsigned> >::_M_mutate(unsigned, unsigned, unsigned)':
: undefined reference to `std::char_traits<unsigned>::copy(unsigned*,
unsigned const*, unsigned)'
"


I tried with g++ 3.3.2 (Debian) :
"
Lecture des spécification à partir de
/usr/lib/gcc-lib/i486-linux/3.3.2/specs
Configuré avec: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared
--with-system-zlib --enable-nls --without-included-gettext
--enable-__cxa_atexit --enable-clocale=gnu --enable-debug
--enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux
Modèle de thread: posix
version gcc 3.3.2 (Debian)
"

This works fine with another compiler on Windows, but I suspect this is
due to the fact that this compiler defines wchar_t as an unsigned int.

Am I doing something wrong ?

Thanks in advance for any clue

[XPost + Fu2 gnu.gcc.help]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top