SFML community forums

Help => General => Topic started by: fetz on August 30, 2013, 01:00:45 am

Title: Getting error on compiling simple SFML program.
Post by: fetz on August 30, 2013, 01:00:45 am
Am getting this error: http://prntscr.com/1o7dpu

Here is the code i am using:

Code: [Select]
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
    }

    return 0;
}

Am using Visual C++ 2010. Thankyou in advanced, Fetz
Title: Re: Getting error on compiling simple SFML program.
Post by: eXpl0it3r on August 30, 2013, 01:41:54 am
Are you mixing debug and release modes?
Title: Re: Getting error on compiling simple SFML program.
Post by: Harkole on August 30, 2013, 10:12:44 pm
I too am having this/similar issue, although I'm using Visual Studio 2012 and can't get it to build or debug (same errors) I've read through the tutorial 4 times and even got my wife to check it in case I was going cross eyed  :o

Here is how I've got everything set up, the console output can be seen at the bottom of the screen. It looks like I've not linked the sfml-graphics-d.lib file correctly is what I think is wrong...?

http://imgur.com/pMLmHPN (http://imgur.com/pMLmHPN) - Link to screen shot
Title: Re: Getting error on compiling simple SFML program.
Post by: FRex on August 30, 2013, 10:19:32 pm
I never tried to link in reverse order like that on visual 2008, 2010 or 2012 so I'm not sure but try linking system -> window -> graphics, and you don't need to link main if you have int main in your program.
Title: Re: Getting error on compiling simple SFML program.
Post by: Harkole on August 30, 2013, 10:21:13 pm
Will try that now, when I didn't have the lib for main in there I had a huge list of issues... following the tutorial it says to start a windows application which expects Tmain (or some such) adding the main lib removed all bar those last two errors.

Edit: reversed order exactly the same error...  :(
Title: Re: Getting error on compiling simple SFML program.
Post by: Harkole on August 30, 2013, 10:35:25 pm
Apologies people, I was being silly!

I had specified a precompiler of SFML_STATIC but not linked the static library, changing them to sfml-xxx-s-d.lib fixed my problem.

Thanks for the fast response though!  :-[