"error C2084: function 'D3DXVECTOR3 FName(int)' already has a body"
I am using Visual Studio 2005 professional.
I don't understand why FName (function name) is taken directly as the function name instead of being replaced with the macro argument.
Code:
// Actual syntax
#define Get_InsProp3(FName,PName,PPart1,PPart2,PPart3,DType,DefVal) inline DType FName (int Instance) { Object_Instance* pInstance; if (GameEngine_Object_Instance_IsValid(Instance)) { pInstance = (Object_Instance*)Instance; return DType(pInstance->##PName##.##PPart1, pInstance->PName##.##PPart2, pInstance->PName##.##PPart3); } else { ReportBadReference_Instance(L#FName, Instance); return DType##DefVal; } };ReportBadReference_Instance(L#FName, Instance); return DefVal; } };
// Simplified with multiple lines
#define Get_InsProp3(FName,PName,PPart1,PPart2,PPart3,DType,DefVal)
inline DType FName (int Instance) {
Object_Instance* pInstance;
if (GameEngine_Object_Instance_IsValid(Instance)) {
pInstance = (Object_Instance*)Instance;
return DType(pInstance->##PName##.##PPart1, pInstance->PName##.##PPart2, pInstance->PName##.##PPart3);
} else {
ReportBadReference_Instance(L#FName, Instance); return DType##DefVal;
}
};