2012年4月16日 星期一

Error C2724 : 'static' should not be used on member functions defined at file scope

I do a stupid thing like below, so got message Error C2724 : 'static' should not be used on member functions defined at file scope

XXX.h
static void functionA();

XXX.cpp
static void functionA()
{
    // do something  
}

We have to remove the key word static from XXX.cpp, or the compiler will regard they are two different functions.
Further more, if you call the functionA(), you may also got the message, error LNK2019: unresolved external symbol 

沒有留言:

張貼留言