读书人

一个C++包含头文件的有关问题

发布时间: 2012-02-21 16:26:23 作者: rapoo

一个C++包含头文件的问题~
主文件是
#include <iostream>

#include "th.h "
using namespace std;

int main(){
hello f;
f.list();
getchar();
return 0;
}

我现在想包含一个头文件 内容是这样的
class hello{

public:
void list();
};

void hello::list(){
cout < < "hello word ";
}
这么简单的程序为什么一编译 就提示
th.h `cout ' undeclared (first use this function)
cout没定义???


[解决办法]
using namespace std;
#include "th.h "

读书人网 >C++

热点推荐