【问题标题】:vs2015 coco2d-x 3.8 error reading characters of stringvs2015 coco2d-x 3.8 读取字符串字符时出错
【发布时间】:2016-03-03 11:07:59
【问题描述】:

请看下面的代码:我不知道为什么会这样

bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if (!glview) { 
        **glview = GLViewImpl::createWithRect("NewCocosProject", Rect(0, 0, 960, 640));**
        director->setOpenGLView(glview);
    }
}

bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
{
    setViewName(viewName);
}

如果我继续,我会得到这个错误:

有人可以帮忙吗?

【问题讨论】:

    标签: c++ c++11 cocos2d-x


    【解决方案1】:

    能否请您在传递之前创建一个单独的字符串对象:

    const & tmpString = std::string("NewCocosProject");
    glview = GLViewImpl::createWithRect(tmpString, Rect(0, 0, 960, 640));
                                        ^^^^^^^^^
    

    我承认,我在这里猜测,但可能对你有用。

    【讨论】:

      【解决方案2】:

      经过2周的努力,我意识到,我用PREBUILD库创建了coco项目,然后在我更改源项目后它不会影响库,所以我得到了各种有趣的错误,我再次下载了最新的coco studio,新建项目时,显示选项:预建或源代码,所以我用源代码项目创建,然后我可以成功运行。

      【讨论】:

        猜你喜欢
        • 2021-05-03
        • 1970-01-01
        • 2020-06-29
        • 1970-01-01
        • 1970-01-01
        • 2018-03-21
        • 2013-05-28
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多