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

Author Topic: Getting error on compiling simple SFML program.  (Read 1578 times)

0 Members and 1 Guest are viewing this topic.

fetz

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Getting error on compiling simple SFML program.
« 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
« Last Edit: August 30, 2013, 01:02:18 am by fetz »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10916
    • View Profile
    • development blog
    • Email
Re: Getting error on compiling simple SFML program.
« Reply #1 on: August 30, 2013, 01:41:54 am »
Are you mixing debug and release modes?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Harkole

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Getting error on compiling simple SFML program.
« Reply #2 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 - Link to screen shot

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Getting error on compiling simple SFML program.
« Reply #3 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.
Back to C++ gamedev with SFML in May 2023

Harkole

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Getting error on compiling simple SFML program.
« Reply #4 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...  :(

Harkole

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Getting error on compiling simple SFML program.
« Reply #5 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!  :-[