SFML community forums

Help => General => Topic started by: wrymn on February 18, 2015, 09:10:48 pm

Title: Cannot get the SFML working
Post by: wrymn on February 18, 2015, 09:10:48 pm
Hi there I am new to SFML, but not to game development.

I have never had so many problems with setting up simple project as with SFML past days. Sorry to say it.
It took me few hours to set up and find the errors because of the 3 types of different libs...etc.

Never mind. I have this code:

#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>


using namespace sf;

int main()
{
        RenderWindow window(VideoMode(640,480),"Game engine");

        CircleShape shape(10.0f);

        while (window.isOpen())
        {
                window.clear();

                window.draw(shape);

                window.display();
        }

        return 0;
}

I get this error:
Error   1   error LNK2001: unresolved external symbol "public: static class sf::RenderStates const sf::RenderStates::Default" (?Default@RenderStates@sf@@2V12@B)   C:\Users\pcName\Documents\Development Projects\Visual Studio Projects\GameEngine\GameEngine\main.obj   GameEngine

When I try to use sf::Color::Black or any other color for shape lets say, I get unresolved external symbol for color as well.

I guess it will be in setting the SFML up, which i cannot set up better from the tutorial.

Thanks.
Title: Re: Cannot get the SFML working
Post by: eXpl0it3r on February 18, 2015, 09:30:49 pm
Do you define SFML_STATIC while linking against the dynamic libraries or the other way around?
Title: Re: Cannot get the SFML working
Post by: wrymn on February 18, 2015, 09:34:18 pm
Do you define SFML_STATIC while linking against the dynamic libraries or the other way around?

I used -d libraries since I am only debugging, but I included static SFML_STATIC. I think that caused the issue.
Or should I use only -s libraries with -s .ddls?

What is the difference?
Title: Re: Cannot get the SFML working
Post by: eXpl0it3r on February 18, 2015, 09:39:08 pm
Well the tutorial is quite clear on the use of SFML_STATIC and the different libraries...
Also if you don't understand the differences between static and shared libraries, you might want to google a bit. It's not like SFML is the gateway to programming C++ with libraries. ;)

Anyways only use the SFML_STATIC definition with static libraries and only use debug libs in debug mode.