简体   繁体   English

OGRE不存在合适的转换函数

[英]OGRE No suitable conversion function exists

I'm having a hard time trying to get an app to compile in Visual Studio 2013. I've solved a good amount of errors but I can't find a solution for the last one. 我很难在Visual Studio 2013中尝试编译应用程序。我已经解决了很多错误,但是找不到最后一个解决方案。

here it is: 这里是:

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 indicates that the line RenderSystemList *renderSystems = mRoot->getAvailableRenderers(); Visual Studio指出该行RenderSystemList *renderSystems = mRoot->getAvailableRenderers(); is the problem, especially mRoot 是问题所在,尤其是mRoot

Here is the error I get: error C2440: 'initializing' : cannot convert from 'const Ogre::RenderSystemList' to 'Ogre::RenderSystemList *' 这是我得到的错误: 错误C2440:“正在初始化”:无法从“ const Ogre :: RenderSystemList”转换为“ Ogre :: RenderSystemList *”

The Ogre API says: Ogre API说:

const RenderSystemList &    getAvailableRenderers (void)

So it returns a const reference and not a pointer. 因此,它返回一个const引用而不是一个指针。 Modify your code like this 像这样修改您的代码

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

The getAvailableRenderers method doesn't return a pointer to a RenderSystemList . getAvailableRenderers方法不会返回指向RenderSystemList的指针。 You'd want to have the value stored in a reference to a RenderSystemList : 您希望将值存储在对RenderSystemList的引用中:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C++ 没有合适的转换 function from to 存在 - C++ no suitable conversion function from to exists 不存在从到 * 的合适转换存在 - No suitable conversion exists from to * exists 不存在从标准字符串到const char *的合适转换函数 - No suitable conversion function from std string to const char * exists 不存在从LoadTask :: MasterFilePtr到MasterFile的合适转换函数* - No Suitable Conversion Function from LoadTask::MasterFilePtr to MasterFile * exists 不存在从“std::string”到“const char *”的合适转换函数 - No suitable conversion function from “std::string” to “const char *” exists 6 IntelliSense:不存在从“ std :: string”到“ int”的合适转换函数 - 6 IntelliSense: no suitable conversion function from “std::string” to “int” exists 不存在从“Magick::Color”到“MagickCore::Quantum”的合适转换 function - no suitable conversion function from “Magick::Color” to “MagickCore::Quantum” exists 从“ std :: string”到“ PVOID”的转换功能不存在 - no suitable conversion function from “std::string” to “PVOID” exists C ++不存在从“日期”到“日期(*)()”的合适转换函数 - C++ no suitable conversion function from “Date” to “Date (*)()” exists 如何修复“没有合适的转换函数从”String“到”const char *“存在”? - How to fix “no suitable conversion function from ”String“ to ”const char *“ exists”?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM