I have this definition of the function in my class.
The .hpp file:
class SomeClass
{
public:
static string DoStuff(string s);
};
The .cpp file:
#include "header.hpp"
string SomeClass::DoStuff(string s)
{
// do something
}
Compiler says:
**error C2039: 'DoStuff' : is not a member of 'SomeClass'**
Can somebody help?
EDIT:
actual offending code
header definition
class DDateTime{
public:
static string date2OracleDate(DATE Date);
}
string DDateTime::date2OracleDate(DATE Date)
{
string s;
s="TO_DATE('" + DDateTime::DateFormat("%d/%m/%Y",Date) + "','dd/MM/YYYY')";
return s;
}
Usually,
.cppfiles must include the matching.hor.hppfile.Is it the case here ?
You can also have namespace issue (missing namespace in
.cppfile or static method definition outside of the namespace, and so on.).Actually, it is difficult to answer until we have the real breaking code.
Moreover, I don’t know if this is sample code, but it seems you used something like
using std::stringorusing namespace stdin your header file.This is a bad idea because it will polute every file in which your header is included. What If someone wants to use your header file but don’t want to “use”
stdbecausestringis the name of one of its classes ?