Debugging

closed account (i8bjz8AR)
I'm getting a few errors when compiling. Here is one.
1
2
string.cpp:16:1: error: prototype for ‘String::String()’ does not match any in class ‘String’
 String::String() //  default constructor  


and here is the code from my .cpp


1
2
3
// using a initializer list and giving null pointer to a char array
String::String() //  default constructor
  : size{0}, chars{strcpy(new char[1], "")} {}


the .hpp code is just

1
2
public:
  String(); // default constructor  
Last edited on
Hi,

Looks Ok so far, maybe we need more context ?

Is String.hpp included in String.cpp?

Can you provide something minimal that we can compile?

Is this the first compiler error? Solving earlier errors can remove later errors.
Topic archived. No new replies allowed.