SFML community forums

Help => General => Topic started by: CodeStepper on August 12, 2012, 06:49:14 pm

Title: Visual Studio 2008 and example in SFML
Post by: CodeStepper 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 :)
Title: Re: Visual Studio 2008 and example in SFML
Post by: CodeStepper on August 12, 2012, 07:03:53 pm
Sorry for this post,
problem solved :D

I change SFML_STATIC to SFML_DYNAMIC  :)
Title: Re: Visual Studio 2008 and example in SFML
Post by: eXpl0it3r on August 12, 2012, 07:43:40 pm
SFML_DYNAMIC isn't needed anymore in SFML 2.0 ;)