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_traitsI jESaIjEE9_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_traitsI jESaIjEE9_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]
--
Rémi Peyronnet