linux下compile时出现的奇怪错误
#include <iostream>
using namespace std;
class Tree
{
private:
string par;
public:
Tree()
{
par = "abc";
}
void seed()
{
cout << "seed la";
}
};
main(int argc,char* argv[])
{
}
我在dev c++下没有问题,但在linux用g++
g++ mytree.cpp -o mytree.exe
mytree.cpp:6: syntax error before `;'
mytree.cpp: In method `Tree::Tree ()':
mytree.cpp:10: `par' undeclared (first use this function)
mytree.cpp:10: (Each undeclared identifier is reported only once for
each function it appears in.)
到底怎回事,百思不解
问题点数:20、回复次数:3Top
1 楼freepl()回复于 2003-09-04 16:37:30 得分 0
程序开头要加上
#include <string.h>Top
2 楼freepl()回复于 2003-09-04 16:38:27 得分 20
dev c++下面默认是加上了那一句的Top
3 楼dmhorse(dmhorse)回复于 2003-09-04 16:47:42 得分 0
靠,他显示的error msg一点用都没,多谢两位Top




