在linux下
#include <iostream>
#include <string>
using namespace std;
class Tree{
private:
int ages;
public:
void set_ages(int age){
this->ages = age;
}
int get_ages(){
return ages;
}
string grow(){
string s = to_string(ages) + "years";
return s;
}
};
int main()
{
Tree t;
t.set_ages(46);
cout << "tree:"<<t.grow()<<endl;
return 0;
}
编译这段简单的代码时,出现了个问题
gcc tree.cpp -o tree
使用该命令即可
gcc -std==c++11 tree.cpp -o tree
感谢点赞