This is not just a newbie scenario. I just stumbled upon this compiler post (GCC 5.4) while refactoring a class to remove some constructor parameters. I forgot to update both the declaration and the definition, and the compiler posted this unintuitive error.
The bottom line is: if the compiler cannot match the signature of the definition with the signature of the declaration, it thinks that the definition is not a constructor, and then does not know how to parse the code, and displays this error. What also happened with OP: std::string not of the same type as string so the signature of the declaration was different from the definition, and this message was posted.
As a note, it would be nice if the compiler looked for almost matching constructor signatures and, finding one, suggested that the parameters did not match, and did not produce this message.
source share