Critique my program, give advice

Pages: 12
I'm not sure, the compiler name is simplyu Dev-c++
How can I check?
Most programs have their version posted under Help → About
Thanks, my version is bloodshed, does it not support c++11?
No. It is extremely outdated and does not even supports C++03 fully. I suggest to move on Orwell DevC++ or to another IDE and compiler.
Ohh, I just updated, wow this is so much better.
Ok, this is the bit i'm having trouble with, I don't know what i'm doing wrong?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
void equipItem()
{
	enum class EQUIPMENT
	{
		rustySword,
		crackedShield,
		rustyAxe,
	};
	
	const std::map<EQUIPMENT, class_item> loot = 
{
    { EQUIPMENT::rustySword, {"Rusty Sword", 2, 2} },
    { EQUIPMENT::crackedShield, {"Cracked Shield", 0, 5} },
    { EQUIPMENT::rustyAxe, {"Rusty Axe", 4, 0} },
};
	

       
}
Both EQIPMENTand loot should be global.
I have it in global and it still won't, this is what i'm getting.
1
2
3
4
5
6
7
8
9
[Warning] scoped enums only available with -std=c++11 or -std=gnu++11 [enabled by default]

[Error] 'EQUIPMENT' is not a class or namespace

[Error] in C++98 'loot' must be initialized by constructor, not by '{...}'

[Warning] extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]

[Error] could not convert '{{<expression error>, {"Rusty Sword", 2, 2}}, {<expression error>, {"Cracked Shield", 0, 5}}, {<expression error>, {"Rusty Axe", 4, 0}}}' from '<brace-enclosed initializer list>' to 'const std::map<EQUIPMENT, class_item>'


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
#include <cstdlib>
#include <iostream>
#include <map>
#include "class_game_board.h"
#include "class_item.h"
#include "class_player.h"

	enum class EQUIPMENT
	{
		rustySword,
		crackedShield,
		rustyAxe,
	};
	
	const std::map<EQUIPMENT, class_item> loot = 
	{
    	{ EQUIPMENT::rustySword, {"Rusty Sword", 2, 2} },
    	{ EQUIPMENT::crackedShield, {"Cracked Shield", 0, 5} },
    	{ EQUIPMENT::rustyAxe, {"Rusty Axe", 4, 0} },
	};

int main()
{
    system("PAUSE");
    return EXIT_SUCCESS;
}
	
You shill didn't turn on C++11 support:
http://stackoverflow.com/a/13634404/3410396
Topic archived. No new replies allowed.
Pages: 12