The declaration you are showing is not sufficient to produce this error, but it can arise if you separate the function declaration and implementation and accidentally have the default in both. Be sure to only specify the default parameter in one of them.
I.e. instead of
// declaration, usually in .h
void print_vector(vector<int>&c, const char *title="");
// implementation, usually in .cpp
void print_vector(vector<int>&c, const char *title="") {
// code
}
do
// declaration, usually in .h
void print_vector(vector<int>&c, const char *title="");
// implementation, usually in .cpp
void print_vector(vector<int>&c, const char *title) {
// code
}
or the other way round, i.e. with the default value in the implementation (though the way shown above is usually preferred, because it makes the behavior and usage clear to a reader of your header file). Also notice the const char* to avoid warnings (or even errors as pointed out by AndreyT, thanks!).