加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

visual C声明一个字符串数组

发布时间:2020-12-16 06:45:14 所属栏目:百科 来源:网络整理
导读:我想使用非托管C. 以下代码: #include"string.h"std::string nodename[100]; 给我以下编译错误: ‘std’ : is not a class or namespace name 解决方法 您正在使用错误的头文件.你应该#includeing string而不是“string.h”: string是定义C STL类std :: s
我想使用非托管C.

以下代码:

#include"string.h"
std::string nodename[100];

给我以下编译错误:

‘std’ : is not a class or namespace
name

解决方法

您正在使用错误的头文件.你应该#includeing< string>而不是“string.h”:

>< string>是定义C STL类std :: string的头文件
>< string.h>是字符串函数的C标准库的头文件,它在C字符串(char *)上运行
>< cstring>是头文件,如< string.h>,但它声明了std命名空间内的所有C字符串函数

对于像这样的系统头文件,您应始终使用尖括号#include它们,而不是双引号.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读