As I've described in my first topic, I'm making a game using the original SFML, and to create maps for my game I'm using Tiled (if you don't know what it is, it's a program where you can build maps and save then as files). And to pass these maps to a SFML window, I need a Tiled map parser. I was using STP, until the point I tried compiling my game and MinGW gave me this
extensive error log:
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\unordered_map:35:0,
from D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:36,
from D:\Desktop\STP-master\include/STP/TMXLoader.hpp:30,
from game.cpp:4:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \
^
In file included from D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:39:0,
from D:\Desktop\STP-master\include/STP/TMXLoader.hpp:30,
from game.cpp:4:
D:\Desktop\STP-master\include/STP/Core/Properties.hpp:73:10: error: 'unordered_map' in namespace 'std' does not name a template type
std::unordered_map<std::string, std::string> properties_;
^
In file included from D:\Desktop\STP-master\include/STP/Core/TileSet.hpp:40:0,
from D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:40,
from D:\Desktop\STP-master\include/STP/TMXLoader.hpp:30,
from game.cpp:4:
D:\Desktop\STP-master\include/STP/Core/Image.hpp:66:11: error: 'int32_t' has not been declared
int32_t trans = -1, const std::string& format = std::string());
^
D:\Desktop\STP-master\include/STP/Core/Image.hpp:95:5: error: 'int32_t' does not name a type
int32_t trans_;
^
In file included from D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:40:0,
from D:\Desktop\STP-master\include/STP/TMXLoader.hpp:30,
from game.cpp:4:
D:\Desktop\STP-master\include/STP/Core/TileSet.hpp:77:69: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
unsigned int margin = 0, sf::Vector2i tileoffset = {0, 0});
^
In file included from D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:41:0,
from D:\Desktop\STP-master\include/STP/TMXLoader.hpp:30,
from game.cpp:4:
D:\Desktop\STP-master\include/STP/Core/Layer.hpp:131:80: error: 'nullptr' was not declared in this scope
void AddTile(unsigned int gid, sf::IntRect tile_rect, tmx::TileSet* tileset = nullptr);
^
D:\Desktop\STP-master\include/STP/Core/Layer.hpp:161:31: error: 'nullptr' was not declared in this scope
tmx::TileSet* tileset = nullptr);
^
In file included from D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:42:0,
from D:\Desktop\STP-master\include/STP/TMXLoader.hpp:30,
from game.cpp:4:
D:\Desktop\STP-master\include/STP/Core/ObjectGroup.hpp:76:46: error: 'int32_t' has not been declared
float opacity, bool visible, int32_t hexcolor = -1);
^
D:\Desktop\STP-master\include/STP/Core/ObjectGroup.hpp:141:39: error: 'nullptr' was not declared in this scope
tmx::TileSet::Tile* tile = nullptr);
^
In file included from D:\Desktop\STP-master\include/STP/TMXLoader.hpp:30:0,
from game.cpp:4:
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:62:37: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11
TileMap(const TileMap& other) = delete;
^
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:63:43: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11
TileMap& operator =(const TileMap&) = delete;
^
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:182:10: error: 'unordered_map' in namespace 'std' does not name a template type
std::unordered_map<std::string, tmx::Layer*> layers_;
^
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:183:10: error: 'unordered_map' in namespace 'std' does not name a template type
std::unordered_map<std::string, tmx::ObjectGroup*> object_groups_;
^
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:184:10: error: 'unordered_map' in namespace 'std' does not name a template type
std::unordered_map<std::string, tmx::ImageLayer*> image_layers_;
^
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:185:17: error: 'unique_ptr' is not a member of 'std'
std::vector<std::unique_ptr<tmx::MapObject>> map_objects_;
^
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:185:17: error: 'unique_ptr' is not a member of 'std'
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:185:50: error: 'map_objects_' was not declared in this scope
std::vector<std::unique_ptr<tmx::MapObject>> map_objects_;
^
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:185:50: error: template argument 1 is invalid
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:185:50: error: template argument 2 is invalid
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:187:10: error: 'unordered_map' in namespace 'std' does not name a template type
std::unordered_map<std::string, tmx::TileSet*> tilesets_hash_;
^
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:188:17: error: 'unique_ptr' is not a member of 'std'
std::vector<std::unique_ptr<tmx::TileSet>> tilesets_;
^
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:188:17: error: 'unique_ptr' is not a member of 'std'
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:188:48: error: 'tilesets_' was not declared in this scope
std::vector<std::unique_ptr<tmx::TileSet>> tilesets_;
^
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:188:48: error: template argument 1 is invalid
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:188:48: error: template argument 2 is invalid
D:\Desktop\Elkiria>
My game's source code is the following:
// game.cpp - the main file
#include <Windows.h>
#include <SFML/Graphics.hpp>
#include <STP/TMXLoader.hpp>
int main()
{
// Setting up window and resources
sf::RenderWindow screen(sf::VideoMode(640, 480), "Elkiria");
sf::Texture tex_titlebg;
tex_titlebg.loadFromFile("bg_title.jpg");
sf::Sprite spr_titlebg;
spr_titlebg.setTexture(tex_titlebg);
sf::Texture tex_tcursor;
tex_tcursor.loadFromFile("spr_cursor.png");
sf::Sprite spr_tcursor;
spr_tcursor.setTexture(tex_tcursor);
sf::Font fon_comicsans;
fon_comicsans.loadFromFile("comic.ttf");
sf::Text txt_tnewgame;
txt_tnewgame.setFont(fon_comicsans);
txt_tnewgame.setString("New Game");
sf::Text txt_tcontinue;
txt_tcontinue.setFont(fon_comicsans);
txt_tcontinue.setString("Continue");
sf::Text txt_texit;
txt_texit.setFont(fon_comicsans);
txt_texit.setString("Exit");
int cursor = 0;
int map;
bool game_started = false;
// While window is open, do stuff
while (screen.isOpen())
{
// Operations with events
sf::Event event;
while (screen.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
screen.close();
}
if (event.type == sf::Event::KeyPressed) {
if (event.key.code == sf::Keyboard::Up) {
if (cursor == 0) {
break;
}
else {
cursor -= 1;
}
}
if (event.key.code == sf::Keyboard::Down) {
if (cursor == 2) {
break;
}
else {
cursor += 1;
}
}
if (event.key.code == sf::Keyboard::Z || event.key.code == sf::Keyboard::Return) {
if (cursor == 0) {
game_started = true;
map = 1;
}
else if (cursor == 1) {
}
else if (cursor == 2) {
ExitProcess(0);
}
}
}
}
// Operations with the window
screen.clear(sf::Color::Black);
screen.draw(spr_titlebg);
screen.draw(txt_tnewgame);
txt_tnewgame.setPosition(240, 300);
screen.draw(txt_tcontinue);
txt_tcontinue.setPosition(240, 340);
screen.draw(txt_texit);
txt_texit.setPosition(240, 380);
screen.draw(spr_tcursor);
screen.display();
// If the game has started, the first map is drawn.
if (game_started == true) {
if (map == 1) {
screen.clear(sf::Color::Black);
tmx::TileMap map1("map1.tmx");
map1.ShowObjects();
screen.draw(map1);
screen.display();
}
}
// If not, the title screen remains and the arrow keys move the cursor.
else if (game_started == false) {
switch (cursor) {
case 0:
spr_tcursor.setPosition(200, 300);
break;
case 1:
spr_tcursor.setPosition(200, 340);
break;
case 2:
spr_tcursor.setPosition(200, 380);
break;
}
}
}
// Source code ends here.
return 0;
}
I even have put the SFML include and lib folders into STP's extlibs folder:
What am I doing wrong? Please, someone help me.