我很难在Visual Studio 2013中尝试编译应用程序。我已经解决了很多错误,但是找不到上一个解决方案。

这里是:

void Application::setupRenderSystem() {
mState->dumpValues();

String val = mState->getStringValue("renderSystem");
RenderSystemList *renderSystems = mRoot->getAvailableRenderers();
RenderSystemList::iterator r_it;

bool renderSystemFound = false;
for (r_it = renderSystems->begin(); r_it != renderSystems->end(); r_it++) {
    RenderSystem *tmp = *r_it;
    std::string rName(tmp->getName());

    // returns -1 if string not found
    if ((int)rName.find(val) >= 0) {
        mRoot->setRenderSystem(*r_it);
        renderSystemFound = true;
        break;
    }
}
if (!renderSystemFound) {
    OGRE_EXCEPT(0, "Specified render system (" + val + ") not found, exiting...", "Application")
}

}

Visual Studio指出RenderSystemList *renderSystems = mRoot->getAvailableRenderers();行是问题所在,尤其是mRoot
这是我得到的错误:
错误C2440:“正在初始化”:无法从“const Ogre::RenderSystemList”转换为“Ogre::RenderSystemList *”

最佳答案

getAvailableRenderers方法不返回指向RenderSystemList的指针。您希望将值存储在对RenderSystemList的引用中:

RenderSystemList const& renderSystems = mRoot->getAvailableRenderers();

09-06 14:03