erwartete identifier, string-Konstante vor

Mit einem Programm wie diesem:

#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;
}

...warum bin ich immer Folgendes, wenn ich ausführen

g++ main.cpp

main.cpp:16:12: error: expected identifier before string constant
main.cpp:16:12: error: expected ‘,’ or ‘...’ before string constant
  • Sie sollten wirklich lernen, immer kompilieren mit g++ -Wall -g
InformationsquelleAutor rahman | 2012-04-07
Schreibe einen Kommentar