我定义了一个返回类型是std::string的函数在read_qacct.h里
#include <string>
std::string read_qacct(std::string login, int days);
然后在db2class.cpp里include了这个头文件
#include "read_qacct.h"
结果编译db2class.cpp时的第一个错误就是:
In file included from db2class.cpp:8:
./read_qacct.h:2:6: error: redefinition of 'string' as different kind of symbol
std::string read_qacct(std::string login, int days);
^
/usr/include/c++/4.2.1/bits/stringfwd.h:59:33: note: previous definition is here
typedef basic_string<char> string;
我用同样方式在read_qacct.cpp里include这个头文件,编译read_qacct.cpp没有任何问题,为什么这里会出错呢?