views:

452

answers:

1

I'm upgrading a game engine's source code from Visual Studio 2003 to Visual Studio 2008. When I try and compile the source code I get the following error.

error C3867: 'UObject::StaticConstructor': function call missing argument list; use '&UObject::StaticConstructor' to create a pointer to member

in the following code:

//----(IMPLEMENT_CLASS macro):
#define IMPLEMENT_CLASS(TClass) \
UClass TClass::PrivateStaticClass \
( \
    EC_NativeConstructor, \
    sizeof(TClass), \
    TClass::StaticClassFlags, \
    TClass::Super::StaticClass(), \
    TClass::WithinClass::StaticClass(), \
    FGuid(TClass::GUID1,TClass::GUID2,TClass::GUID3,TClass::GUID4), \
    TEXT(#TClass)+1, \
    GPackage, \
    StaticConfigName(), \
    RF_Public | RF_Standalone | RF_Transient | RF_Native, \
    (void(*)(void*))TClass::InternalConstructor, \
    (void(UObject::*)())TClass::StaticConstructor \ /* ERROR ON THIS LINE */
); \
extern "C" DLL_EXPORT UClass* autoclass##TClass;\
DLL_EXPORT UClass* autoclass##TClass = TClass::StaticClass();

Note: This code snippet is from http://www.experts-exchange.com/Programming/Languages/CPP/Q%5F20756876.html (Needless to say they are exactly same)

I am not sure how should I re-write the line so that there are no errors.

(void(UObject::*)())TClass::StaticConstructor \
+4  A: 

The error message says it all: add the missing ampersand.

(void(UObject::*)())&TClass::StaticConstructor \

Edit: I'd also remove the cast, which is either unnecessary or wrong.

avakar