C++ Python扩展数组大小问题(C2133)

2024-10-01 11:38:42 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在创建一个游戏扩展,它将游戏api公开给一个嵌入式python解释器,我在PyMethodDef中得到一个C2133数组未知大小的错误:

static PyMethodDef pyTTPlayerMethods[] = {
{"Get_Player_Name", pyTTGet_Player_Name, METH_VARARGS, "Returns the nickname of a client."},
{"Get_Player_Type", pyTTGet_Player_Type, METH_VARARGS, "TODO: Returns the player type of a client."},
{"Get_Bandwidth", pyTTGet_Bandwidth, METH_VARARGS, "Returns a player's bandwidth."},
{"Get_Ping", pyTTGet_Ping, METH_VARARGS, "Returns the ping of a client."},
{"Get_Kbits", pyTTGet_Kbits, METH_VARARGS, "Return kbits of a client."},
{"Get_Ip", pyTTGet_Ip_Address, METH_VARARGS, "Returns the IP of a client."},
{"Get_Port", pyTTGet_Ip_Port, METH_VARARGS, "Returns the port of a client."},
{"Get_Team", pyTTGet_Team, METH_VARARGS, "Returns the team ID of a client."},
{"Get_Translated_Team", pyTTGet_Translated_Team, METH_VARARGS, "Returns the team name of a client (GDI, NOD)."},
{"Change_Team", pyTTChange_Player_Team, METH_VARARGS, "Changes the team of a client."},
{"Change_Team2", pyTTChange_Player_Team2, METH_VARARGS, "Changes the team of a client without killing respawning the player."},
{"Get_Kills", pyTTGet_Kills, METH_VARARGS, "Returns the kill count of a client."},
{"Get_Deaths", pyTTGet_Deaths, METH_VARARGS, "Returns the death count of a client."},
{"Get_KD", pyTTGet_KillDeath_Ratio, METH_VARARGS, "Returns the KD ratio of a client."},
{"Get_Rank", pyTTGet_Rank, METH_VARARGS, "Returns the rank of a client."},
{"Set_Rung", pyTTSet_Rung, METH_VARARGS, "Sets the rung of a client."},
{"Set_Ladder_Points", pyTTSet_Ladder_Points, METH_VARARGS, "Returns the rank of a client."},
{"Get_Score", pyTTGet_Score, METH_VARARGS, "Returns the score of a client."},
{"Set_Score", pyTTSet_Score, METH_VARARGS, "Sets the score of a client."},
{"Get_Money", pyTTGet_Money, METH_VARARGS, "Returns the amount of money a client has."},
{"Set_Money", pyTTSet_Money, METH_VARARGS, "Sets the amount of money a client has."},
{"Refill", pyTTGrant_Refill, METH_VARARGS, "Replenishes a client's health and ammo."},
{"Change_Character", pyTTChange_Character, METH_VARARGS, "Changes a client's character."},
{"Toggle_Fly_Mode", pyTTToggle_Fly_Mode, METH_VARARGS, "Toggles a client's flying mode."},
{"Is_Stealth", pyTTIs_Stealth, METH_VARARGS, "Returns a client's stealth status."},
{NULL, NULL, 0, NULL}
};

在编译插件时,我得到的结果是:

^{pr2}$

第一个错误是因为我在PyObject中选择了错误的调用,但是我不知道如何更正最后一个错误(C2133);有什么建议吗?在


Tags: oftheclientget错误teamreturnsscore