错误R6010。为什么叫它? [英] Error R6010. Why is it called?

查看:518
本文介绍了错误R6010。为什么叫它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个基本的2D游戏。我的代码在Visual Studio 2010中工作得很好。但是,当我创建一个.exe并运行它,我收到一个消息,说明调试错误,R6010,中止被调用。

I am creating a basic 2D game. My code works perfectly well in Visual Studio 2010. However when i create a .exe and run it, I receive a message stating "Debug Error, R6010, Abort has been called".

从头开始,添加位代码,直到我找到错误,我已将问题缩小到下面的代码。我已经包括整个函数,但可以提供更多的代码,如果必要。

By starting from scratch and adding bits of code until I find the error I have narrowed the problem down to the code below. I have included the whole function but can provide more code if necessary.

对其他人的问题的问题表明,这个问题是与错误不被捕获有关的(我已经尝试try / catch语句无效)。但是我不能看到代码运行没有他们在调试模式。

Answers to other peoples questions suggest that the problem is something to do with an error not being caught (I have experimented with try/catch statements to no avail). However I can not see where as the code runs without them in debug mode.

如果有任何建议,我将非常感激。

If anyone has any suggestions I would be very grateful.

  void initGUI()
{

//Button Types correspond to which section of the screen the button will be displayed in. 
//type 1 = Top Bar,
//type 2 = Main Body,
//type 3 = Overlay window (gui1 only)

bool endFile = false;
string totalGUIString;
string text;
vector<string> stringVector;

//Open the file
cout << "Opening file buttons.txt" << endl;
fstream textFile;
textFile.open("buttons.txt");

//Read the first line and determine the amount of GUI's that need to be created
textFile >> totalGUIString;
int totalGUIs = convertStringToInt(totalGUIString);
cout << "Total number of GUI's to load = " << totalGUIs << endl;

//Create the correct amount of GUI's
for(int j = 0; j < totalGUIs; j++)
{
    guiMatrix.push_back(gui(j));
}

textFile >> text;

while(endFile == false) //Search through the main body of the file
{
    //textFile >> text;

    if(text == "END") 
    {
        endFile = true;
        cout << "Reached the end of the file" << endl;
    }
    else
    {
        stringVector.push_back(text);
        //cout << "PushBack:"  << text << endl;

        if(text == "E")
        {
            //Use vector to populate the button constructor
            int button0 = convertStringToInt(stringVector[0]);
            int button1 = convertStringToInt(stringVector[1]);
            string button2 = stringVector[2];
            int button3 = convertStringToInt(stringVector[3]);

            //cout << "TESTING:: " << button0 << " " << button1 << " " << button2 << " " << button3 << endl;

            guiMatrix[button0].addButton(button1, button2, button3);

            stringVector.clear();

        }

        textFile >> text;
    }
}

textFile.close();

//For every guiMatrix print the button list to cout. 
for(int a = 0; a < totalGUIs; a++)
{
    guiMatrix[a].printButtonMatrix();
}
} 

输入的文本文件如下所示:
顶部的数字定义了我要创建多少个GUI页面。
每个条目的格式如下:页码,位置句柄,名称,效果持续时间,结束

The text file being inputted looks like this: The number at the top defines how many GUI pages I want to create. The format of each entry is as follows: Page Number, Location handle, name, duration of effect, End

5

0 2 Explore 0 E
0 2 Technologies 0 E
0 2 Buildings 0 E
0 2 Workers 0 E

0 1 Scoop_Water 10 E
0 1 Collect_Water 10 E
0 1 Forage 10 E
0 1 Gather_Twigs 10 E
0 1 Fell_Trees 10 E

1 2 Enter 0 E

1 1 Build_Road 1 E

2 2 Explore 0 E
2 2 Main 0 E
2 2 Buildings 0 E
2 2 Workers 0 E

2 1 Backpack 0 E
2 1 Hand_Cart 0 E

3 2 Explore 0 E
3 2 Main 0 E
3 2 Technologies 0 E
3 2 Workers

3 1 Build_Hut 0 E

4 2 Explore 0 E
4 2 Main 0 E
4 2 Technologies 0 E
4 2 Buildings 0 E


END


推荐答案

.png 文件无法找到时, code> .exe。如果没有找到这些文件,没有提供应该做什么。

The errors were being thrown when .png files could not be found by the .exe. There was no provision for what should be done if these files were not found.

通过将相关的 .png 文件移动到与可执行文件相同的文件夹中来解决。

Solved by moving relevant .png files into the same folder as the executable.

这篇关于错误R6010。为什么叫它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆