有这样一个程序:
#include <iostream>
#include <string>
using namespace std;
class test
{
public:
test(std::string s):str(s){};
private:
std::string str;
};
class test1
{
public:
test tst_("Hi");
};
int main()
{
return 1;
}
我执行
时为什么会得到以下的结果?g++ main.cpp
main.cpp:16:12: error: expected identifier before string constant
main.cpp:16:12: error: expected ‘,’ or ‘...’ before string constant
g++ -Wall -g
进行编译。 - Basile Starynkevitch-Wall
: "Enable most warning messages." and-g
: "Generate debug information in default format." or "generate debugging information" -- source:g++ -v --help
- Milan