You declared Str::ToInt()
as a member of the namespace Str
but you defined a function outside of any namespace with the same name ToInt()
. You need to, at least, Str::
in front of the definition:
int Str::ToInt(unsigned char* Source) { ... }
Question
I added a new function into my library, and while compiling Gcc refuse to recognize it. Every function works without problem, and this is the only one that give problem.
String.hpp
#ifndef __String_Included__
#define __String_Included__
namespace Str
{
//Other prototype
int ToInt(unsigned char*);
};
#endif
String.cpp
int ToInt(unsigned char* Source)
{
//Codecodecodecodecodecodecode
}
When I call Str::ToInt in the main I get that error. I'm working on Codeblocks 12.11 and Windows 8
Solution
You declared Str::ToInt()
as a member of the namespace Str
but you defined a function outside of any namespace with the same name ToInt()
. You need to, at least, Str::
in front of the definition:
int Str::ToInt(unsigned char* Source) { ... }