为什么字符串未在范围中声明 [英] why is string not declared in scope

查看:134
本文介绍了为什么字符串未在范围中声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:

#include <string>
#include <boost/thread/tss.hpp>

static boost::thread_specific_ptr<string> _tssThreadNameSptr;

我收到以下错误


g ++ -c -I $ BOOST_PATH tssNaming.h

g++ -c -I$BOOST_PATH tssNaming.h

tssNaming.h:7:error:'string' p>

tssNaming.h:7: error: 'string' was not declared in this scope

但是我在 #include 中包含字符串。

But I am including string in my #include.

推荐答案

您必须使用 std :: string ,因为它在 std 命名空间。

You have to use std::string since it's in the std namespace.

这篇关于为什么字符串未在范围中声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆