hi guys!
i'm trying to make a snake clon right now, but i have problem
for the elements of the snake, i'm using a stl-list of sf::Shape;
as i'm trying to push a shape into the list, there arise some errors
here's the code:
#include <iostream>
#include <SFML/Graphics.hpp>
#include <list>
using namespace std;
enum gamestate
{
menu,spiel,gameover
};
enum richtung
{
links,rechts,oben,unten
};
sf::RenderWindow fenster(sf::VideoMode(800, 600, 32), "Snake");
gamestate gs = spiel;
richtung richt = links;
const int tilesize = 20;
list<sf::Shape> snake;
list<sf::Shape>::iterator iter;
void draw();
void move();
int main()
{
snake.push_back(sf::Shape::Rectangle(100,100,200,200,sf::Color(0,0,255)));
while (fenster.IsOpened())
{
sf::Event Event;
while (fenster.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
fenster.Close();
}
move();
draw();
}
return EXIT_SUCCESS;
}
errors arise when adding line:
snake.push_back(sf::Shape::Rectangle(100,100,200,200,sf::Color(0,0,255)));
now the errors:
Project : Console application
Compiler : GNU GCC Compiler (called directly)
Directory : E:\Programmieren\CodeBlocks\meins\sfml snake\
--------------------------------------------------------------------------------
Switching to target: default
Compiling: main.cpp
Linking console executable: E:\Programmieren\CodeBlocks\meins\sfml snake\snake.exe
Info: resolving vtable for sf::Shapeby linking to __imp___ZTVN2sf5ShapeE (auto-import)
Info: resolving vtable for sf::Drawableby linking to __imp___ZTVN2sf8DrawableE (auto-import)
.objs\main.o:main.cpp:(.text$_ZN2sf5ShapeD1Ev[sf::Shape::~Shape()]+0x3a): variable 'vtable for sf::Shape' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.
.objs\main.o:main.cpp:(.text$_ZN2sf5ShapeC1ERKS0_[sf::Shape::Shape(sf::Shape const&)]+0x4c): variable 'vtable for sf::Shape' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.
.objs\main.o:main.cpp:(.text$_ZN2sf8DrawableC2ERKS0_[sf::Drawable::Drawable(sf::Drawable const&)]+0xa): variable 'vtable for sf::Drawable' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.
collect2: ld returned 1 exit status
hope you can help me
sorry for bad english.