小编ali*_*ius的帖子

为什么在包含 <string.h> 并使用 std::basic_string 时会出现编译器错误?

当我尝试编译以下代码时:

\n\n
#include <string.h>\nusing namespace std;\ntypedef std::basic_string<char> foostring;\nfoostring foo = "foo";\n
Run Code Online (Sandbox Code Playgroud)\n\n

我收到以下错误:

\n\n
stringtest.cpp:5: error: expected initializer before \xe2\x80\x98<\xe2\x80\x99 token\nstringtest.cpp:6: error: \xe2\x80\x98foostring\xe2\x80\x99 does not name a type\n
Run Code Online (Sandbox Code Playgroud)\n\n

我的编译器是: g++ (Ubuntu 4.4.1-4ubuntu9) 4.4.1
\n我做错了什么?一旦我弄清楚如何使用它,我打算将其与 Windows TCHAR 一起使用以支持 unicode。

\n

c++ stdstring

2
推荐指数
1
解决办法
404
查看次数

标签 统计

c++ ×1

stdstring ×1