c++头文件string有问题!

来源:百度知道 编辑:UC知道 时间:2024/06/06 15:12:41
在头文件中,为什么#include<string.h>错误,而#include<string>using namespace std;正确呢?

#include <string.h>
本身不应发生错误,因为它只是嵌入一个string.h文件。C的写法,C++可用。
有的编译器是 <strings.h>

如果编译时告诉你缺了什么东西,补入就可以了。

using namespace std; 是 #include <stdio.h> #include <stdlib.h> 等 std* (标准) 头文件。

#include <string> C++ 的写法

*代表string,iostream,ctime...
#include<*>为标准C++语言,是通用的
#include<*.h>不是标准,可以在别的,C,VC中用也许没问题.在C++中用的快可能通过不了编译

是不同的表示