我正在将游戏引擎的源代码从Visual Studio 2003升级到Visual Studio 2008.当我尝试编译源代码时,我收到以下错误。
错误C3867:'UObject :: StaticConstructor':函数调用缺少参数列表;使用'& UObject :: StaticConstructor'创建指向成员的指针
在以下代码中:
//----(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();
注意:此代码段来自http://www.experts-exchange.com/Programming/Languages/CPP/Q_20756876.html(毋庸置疑,它们完全相同)
我不知道应该如何重新编写该行,以便没有错误。
(void(UObject::*)())TClass::StaticConstructor \
答案 0 :(得分:4)
错误消息说明了一切:添加丢失的&符号。
(void(UObject::*)())&TClass::StaticConstructor \
编辑:我也会删除演员表,这是不必要的或错误的。