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

Author Topic: Cannot get the SFML working  (Read 1504 times)

0 Members and 1 Guest are viewing this topic.

wrymn

  • Newbie
  • *
  • Posts: 2
    • View Profile
Cannot get the SFML working
« 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.
« Last Edit: February 18, 2015, 09:26:56 pm by wrymn »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Cannot get the SFML working
« Reply #1 on: February 18, 2015, 09:30:49 pm »
Do you define SFML_STATIC while linking against the dynamic libraries or the other way around?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

wrymn

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Cannot get the SFML working
« Reply #2 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?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Cannot get the SFML working
« Reply #3 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything