-1
我有這樣的代碼(片段):在3號線和5線的原因錯誤命名類
for (itr = GameObjectList.begin(); itr != GameObjectList.end(); ++itr)
{
if ((*itr)->GetComponent<Light>() && (*itr)->GetComponent<Light>()->GetEnable())
{
(*itr)->GetComponent<Light>()->Render();
}
}
錯誤,命名爲「光」,這是我的引擎的一個組成部分,如果我改變該類的名稱輕到任何其他名稱(例如「Light2」)它的工作原理!
的GetComponent模板函數是:
template <typename T>
T* GetComponent()
{
for(itr = CompList.begin() ; itr != CompList.end() ; ++itr)
{
if (T* type = dynamic_cast<T*>(*itr))
{
return type;
}
}
return NULL;
};
什麼F#%K是怎麼回事?也許文件損壞,與我的CPP文件?我不知道
在此先感謝!
編輯:
error: no matching function for call to 'GameObject::GetComponent()'
你的錯誤信息是什麼? – mstbaum
您需要顯示更多代碼,例如整個函數的第一個代碼片段。 –
沒有更多的代碼,因爲它可以很好地與任何其他名稱一起使用,只有「Light」失敗 – lightbug