首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

在winXP上,g++编译wstring,求高人指点

2013-02-27 
在winXP下,g++编译wstring,求高人指点hello.cpp:#define _GLIBCXX_USE_WCHAR_T 1#define _GLIBCXX_USE_WST

在winXP下,g++编译wstring,求高人指点
hello.cpp:

#define _GLIBCXX_USE_WCHAR_T 1
#define _GLIBCXX_USE_WSTRING 1
#include <string>
#include <iostream>

using namespace std;

int  main()
{
wstring s11 = L"hello world!";
        return 0 ;
}

=======================================
$ g++ -o hello.exe hello.cpp

=======================================
/tmp/ccqYCfYU.o:hello.cpp:(.text+0x184): undefined reference to `std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::basic_string(wchar_t const*, std::allocator<wchar_t> const&)'
/tmp/ccqYCfYU.o:hello.cpp:(.text+0x1d5): undefined reference to `std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::~basic_string()'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: /tmp/ccqYCfYU.o: bad reloc address 0x0 in section `.ctors'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: final link failed: Invalid operation
collect2: ld returned 1 exit status


=======================================
求解,为什么 wstring 编译不过呢?
[解决办法]
我这边在Ubuntu下用GCC编译是没有问题的。
[解决办法]
Thread model: win32
gcc version 4.7.1 (tdm-1)
mingw32 没问题

热点排行