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

Author Topic: Visual Studio 2008 and example in SFML  (Read 1303 times)

0 Members and 1 Guest are viewing this topic.

CodeStepper

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Visual Studio 2008 and example in SFML
« on: August 12, 2012, 06:49:14 pm »
So, when i compile this code:
#include <SFML/Graphics.hpp>

using namespace sf;

int main( void )
{
        VideoMode videoMode( 640, 480 );
        RenderWindow window( videoMode, "Wy&#347;wietlanie okna" );
       
        RectangleShape rectangle;
        rectangle.setPosition( 30, 30 );
        rectangle.setSize( Vector2f( 50, 30 ) );

        rectangle.setRotation( 45 );
        rectangle.setFillColor( Color::Yellow );
        rectangle.setOutlineColor( Color::Blue );
        rectangle.setOutlineThickness( 3 );

        while( window.isOpen( ) )
        {
                window.clear( );
                window.draw( rectangle );
                window.display( );

                Event event;
                while( window.pollEvent( event ) )
                {
                        if( event.type == Event::Closed )
                                window.close( );
                        else if( event.type == Event::KeyPressed )
                        {
                                switch( event.key.code )
                                {
                                case Keyboard::Escape: window.close( ); break;
                                case Keyboard::Up: rectangle.move( 0, -10 ); break;
                                case Keyboard::Down: rectangle.move( 0, 10 ); break;
                                case Keyboard::Left: rectangle.move( -10, 0 ); break;
                                case Keyboard::Right: rectangle.move( 10, 0 ); break;
                                }
                        }
                }
        }

        return EXIT_SUCCESS;
}

And compiler return this errors...:
main.obj : error LNK2001: unresolved external symbol "public: static class sf::RenderStates const sf::RenderStates::Default" (?Default@RenderStates@sf@@2V12@B)
main.obj : error LNK2001: unresolved external symbol "public: static class sf::Color const sf::Color::Blue" (?Blue@Color@sf@@2V12@B)
main.obj : error LNK2001: unresolved external symbol "public: static class sf::Color const sf::Color::Yellow" (?Yellow@Color@sf@@2V12@B)

What i'm doing wrong? :/
Please, help me :)

CodeStepper

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: Visual Studio 2008 and example in SFML
« Reply #1 on: August 12, 2012, 07:03:53 pm »
Sorry for this post,
problem solved :D

I change SFML_STATIC to SFML_DYNAMIC  :)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Visual Studio 2008 and example in SFML
« Reply #2 on: August 12, 2012, 07:43:40 pm »
SFML_DYNAMIC isn't needed anymore in SFML 2.0 ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything