Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: problems with sf::shape and list of stl  (Read 2962 times)

0 Members and 1 Guest are viewing this topic.

kwuuak

  • Newbie
  • *
  • Posts: 11
    • View Profile
problems with sf::shape and list of stl
« on: March 22, 2009, 08:25:39 pm »
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:

Code: [Select]

#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:

Code: [Select]

snake.push_back(sf::Shape::Rectangle(100,100,200,200,sf::Color(0,0,255)));



now the errors:

Code: [Select]

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.
Code: [Select]

Daazku

  • Hero Member
  • *****
  • Posts: 896
    • View Profile
problems with sf::shape and list of stl
« Reply #1 on: March 22, 2009, 08:49:48 pm »
Quote
snake.push_back(new sf::Shape::Rectangle(100,100,200,200,sf::Color(0,0,255)));


?
Pensez à mettre le tag [Résolu] une fois la réponse à votre question trouvée.
Remember to add the tag [Solved] when you got an answer to your question.

kwuuak

  • Newbie
  • *
  • Posts: 11
    • View Profile
problems with sf::shape and list of stl
« Reply #2 on: March 22, 2009, 08:55:55 pm »
then it says:

"error: `class sf::Shape::Rectangle' is not a type "

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
problems with sf::shape and list of stl
« Reply #3 on: March 22, 2009, 09:34:26 pm »
You have to define the SFML_DYNAMIC macro if you use the dynamic libraries (see "getting started" tutorial).
Laurent Gomila - SFML developer

kwuuak

  • Newbie
  • *
  • Posts: 11
    • View Profile
problems with sf::shape and list of stl
« Reply #4 on: March 22, 2009, 09:57:42 pm »
thx:)


solved

 

anything