太没有道理了,g++编译这么简单的程序出现错误:‘string’不是一个类型名

太没有道理了,g++编译这么简单的程序出现错误:‘string’不是一个类型名

问题描述:

using namespace std;
#include

template
class tree_node_t
{
public:
string &to_string(string *result, int prefix = 0);
void set_data(const T &data);

protected:
T m_data;
};

vs编译得好好的,g++怎么了,老是这些莫名其妙的错误?哪位高手能看出端倪指教一下啊?谢谢!

原来要加#include <iostream>,调试g++真麻烦,不知道vs怎么不用呢???

第二行尖括号和里面的csting被csdn自动去掉了,源代码是有的

#include <cstring>

using namespace std;
#include <cstring>

template <typename T>
class tree_node_t
{
public:
string &to_string(string *result, int prefix = 0);
void set_data(const T &data);

protected:
T m_data;
};

vs编译得好好的,g++怎么了,老是这些莫名其妙的错误?哪位高手能指教一下啊?谢谢!

错误报告说:‘string’不是一个类型名
真的莫名其妙!不是有using namespace std;#include <cstring>吗??即使用std::string也不行

#include
#include
using namespace std;