Transition from Orwell Dev-C++ to Visual Studio 2013

So essentially I decided to switch IDEs from Orwell Dev-C++ to the express version of Visual Studio 2013. Well, my code that was running just fine compiled in Dev-C++, is giving me errors when I attempt to debug it in VS2013.

error message:
Unhandled exception at 0x7526B760 in Lebard's Quest.exe: Microsoft C++ exception: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::property_tree::ptree_bad_path> > at memory location 0x001FB9A0.


code in question:

fileManager.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef FILEMANAGER_HPP
#define FILEMANAGER_HPP

#include <string>

struct loadedItem{

	std::string name;
	std::string description;
	std::string icon;
	int equipment_slot;
	int armor_rating;
	int min_damage;
	int max_damage;
	bool special_use;
	int addToHealth;
	int addToMana;

};

class filesystem{

public:

	loadedItem itemBuffer;

	void exportItem(loadedItem itemData, int fileID);
	void importItem(int fileID);
	void clearItemBuffer();

};

#endif 


fileManager.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <string>
#include <fstream>
#include <sstream>

#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>

#include "fileManager.hpp"

using boost::property_tree::ptree;

void filesystem::exportItem(loadedItem itemData, int itemID){
	
	std::ostringstream convert;
	
	ptree pt;
	
	//convert the itemID into a string as a filename, for example, 1.item
	std::string filename;
	convert << itemID;
	filename = convert.str();
	filename.append(".item");
	
	pt.put("item.name", itemData.name.c_str());
	pt.put("item.description", itemData.description.c_str());
	pt.put("item.iconFilename", itemData.icon.c_str());
	pt.put("item.equipmentSlot", itemData.equipment_slot);
	pt.put("item.armorRating", itemData.armor_rating);
	pt.put("item.minDmg", itemData.min_damage);
	pt.put("item.maxDmg", itemData.max_damage);
	pt.put("item.specialUse", itemData.special_use);
	pt.put("item.addToHealth", itemData.addToHealth);
	pt.put("item.addToMana", itemData.addToMana);
	
	write_xml (filename.c_str(), pt);
	
}

void filesystem::importItem(int itemID){
	
	std::ostringstream convert;
	
	//convert the itemID into a string as a filename, for example, 1.item
	std::string filename;
	convert << itemID;
	filename = convert.str();
	filename.append(".item");
	
	ptree pt;
		
	read_xml(filename.c_str(), pt);

	itemBuffer.name = pt.get<std::string> ("item.name");
	itemBuffer.description = pt.get<std::string> ("item.description");
	itemBuffer.icon = pt.get<std::string> ("item.iconFilename");
	itemBuffer.equipment_slot = pt.get<int> ("item.equipmentSlot");
	itemBuffer.armor_rating = pt.get<int> ("item.armorRating");
	itemBuffer.min_damage = pt.get<int> ("item.minDmg");
	itemBuffer.max_damage = pt.get<int> ("item.maxDmg");
	itemBuffer.special_use = pt.get<bool> ("item.specialUse");
	itemBuffer.addToHealth = pt.get<int> ("item.addToHealth");
	itemBuffer.addToMana = pt.get<int> ("item.addToMana");

}

void filesystem::clearItemBuffer(){

	itemBuffer.name = "";
	itemBuffer.description = "";
	itemBuffer.icon = "";
	itemBuffer.equipment_slot = 0;
	itemBuffer.armor_rating = 0;
	itemBuffer.min_damage = 0;
	itemBuffer.max_damage = 0; 
	itemBuffer.special_use = 0;
	itemBuffer.addToHealth = 0;
	itemBuffer.addToMana = 0;

}


inventory.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef INVENTORY_HPP
#define INVENTORY_HPP

#include "fileManager.hpp"
#include "itemManager.hpp"

struct slot{

	int itemID;
	item itemData;

};

class container{

public:
	slot slots[100];
	int bagSpace;
	
	void init();
	bool add(int itemID);
	bool remove(int itemID);
	bool hasItem(int itemID);
	bool isFull();

};


#endif 


the portion of inventory.cpp that is giving me issues
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "inventory.hpp"
#include "fileManager.hpp"
#include "itemManager.hpp"


void container::init(){

	filesystem IOBuffer;
	
	for (int x = 1; x < bagSpace; x++){
	slots[x].itemID = 0;
	IOBuffer.clearItemBuffer();
	IOBuffer.importItem(0);
	slots[x].itemData.setValues(IOBuffer);
	
	}

}

bool container::add(int itemID){

	filesystem IOBuffer;
	
	for (int x = 1; x <= bagSpace; x++){
		if (slots[x].itemID == 0){
			slots[x].itemID = itemID;
			IOBuffer.clearItemBuffer();
			IOBuffer.importItem(itemID);
			slots[x].itemData.setValues(IOBuffer);
			
			x = bagSpace + 1;
			return 1;
		}
		if (x == bagSpace && slots[x].itemID != 0){
			return 0;
		}
	
	}

}


itemManager.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef ITEM_MANAGER_HPP
#define ITEM_MANAGER_HPP

#include "fileManager.hpp"

class item{

public:
	std::string name;
	std::string description;
	std::string icon;
	int equipment_slot;
	int armor_rating;
	int min_damage;
	int max_damage;
	bool special_use;
	int addToHealth;
	int addToMana;
	
	void setValues(filesystem file);

};		
#endif 


itemManager.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "itemManager.hpp"
#include "fileManager.hpp"

void item::setValues(filesystem file){

	this->name = file.itemBuffer.name;
	this->description = file.itemBuffer.description;
	this->icon = file.itemBuffer.icon;
	this->equipment_slot = file.itemBuffer.equipment_slot;
	this->armor_rating = file.itemBuffer.armor_rating;
	this->min_damage = file.itemBuffer.min_damage;
	this->max_damage = file.itemBuffer.max_damage;
	this->special_use = file.itemBuffer.special_use;
	this->addToHealth = file.itemBuffer.addToHealth;
	this->addToMana = file.itemBuffer.addToMana;
}


I know this a lot of code with poor documentation, but essentially what all these files together are supposed to accomplish is:

load file off the the xml file using import(itemID); into the loadedItem itemBuffer, variable. setValues(loadedItem) will set the values of that itemBuffer variable and put them into the inventory slot.

Would anyone be able to look at my code and see where my issue is? Like I said, this compiled file in Dev-C++. Please ask questions if you are unsure as to what a portion of the code does. Thank you.
Last edited on
Run it in the debugger and let it crash, then look back at the call stack to see where in your code the crash was triggered.

If you're not sure what to do from there, then post the call stack and someone can take a look.
Topic archived. No new replies allowed.