【发布时间】:2019-04-10 09:43:06
【问题描述】:
我想使用字符串类。
我是否也应该参与using namespace std;?
我认为#include <string> 就足够了,但在 CLion 中,当这两个(命名空间或包含)中只有一个不存在时,会出现一些错误。
让事情变得更复杂的是<string> 或<strings.h>。有什么区别?
【问题讨论】:
-
#include <string>,然后使用std::string。标准标头没有扩展名。 -
“当这两个中只有一个不存在时”。两个什么?
-
using namespace std;唯一的作用是它允许您在标准库的名称之前不要写std::。你仍然需要#includes。 -
关于using namespace std...
-
@Quentin 你的意思是
的“标准标题”?
标签: c++ namespaces include