I have some code which I could not compile it yet. The compiler says there should be a closing bracket, but I can't see a reason for this or place to put it. This is my code:
#include "Player.h"
Player(std::string val){
set_Name(val);
set_Alliance("NONE");
set_LastUpdate();
}
Player(std::string val, std::string ally){
set_Name(val);
set_Alliance(ally);
set_LastUpdate();
}
I have included in Player.h
This is the error:
error: expected ')' before 'val'
This is the prototype for constructor:
Player(std::string);
I am using GNU GCC compiler, under linux(ubuntu)
You are missing the class name from constructor outside the class definition. Try this:
Unverified speculation: With your current code, compiler sees Player(symbol1 symbol2) and takes that as creating object of class Player, and first thing it fails to understand is seeing two symbols as constructor argument, and gives a somewhat misleading error about that.