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

Author Topic: Problem Building the SFML 2.0 Release Candidate  (Read 2739 times)

0 Members and 1 Guest are viewing this topic.

diegonolan

  • Newbie
  • *
  • Posts: 26
    • View Profile
Problem Building the SFML 2.0 Release Candidate
« on: May 17, 2012, 05:25:58 am »
I had sfml 2.0 running from the compiled source. I noticed that the sfml 2.0 release candidate was posted so I thought I would update and I am having trouble compiling a simple example, which I assume is a problem linking.

This is the error I get
main.obj : error LNK2001: unresolved external symbol "public: static class sf::RenderStates const sf::RenderStates::Default" (?Default@RenderStates@sf@@2V12@B)
1>C:\Users\Nolan\documents\visual studio 2010\Projects\mapmaker\Debug\mapmaker.exe : fatal error LNK1120: 1 unresolved externals

and this is all the code I am using

#include <iostream>
#include <SFML/Graphics.hpp>

using std::cout;
using std::endl;

int main()
{
        sf::RenderWindow window(sf::VideoMode(300, 200), "SFML works!");
        sf::Text text("Hello SFML");

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

        return 0;
}
 

Everything compiles except the ' window.draw( text ); ' line so there is something wrong there but I am unsure what it is.  The new release came with precompiled .dll's so I didn't compile anything with cmake or Nmake.  Also I deleted all old sfml related stuff so there shouldn't be a problem with that.  This is visual studio  2010.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Problem Building the SFML 2.0 Release Candidate
« Reply #1 on: May 17, 2012, 10:08:56 am »
Have tried to clean and rebuild your project?

Are you using static or dynamic SFML libraries?
Laurent Gomila - SFML developer

diegonolan

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Problem Building the SFML 2.0 Release Candidate
« Reply #2 on: May 17, 2012, 07:23:19 pm »
I cleaned and rebuilt.  I am using static, and I included the SFML_STATIC define.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Problem Building the SFML 2.0 Release Candidate
« Reply #3 on: May 17, 2012, 07:33:13 pm »
Could you upload your project? If it could be self-contained, ie. I can open it and click "compile" directly, it would be perfect :)
Laurent Gomila - SFML developer

diegonolan

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Problem Building the SFML 2.0 Release Candidate
« Reply #4 on: May 17, 2012, 07:43:38 pm »
My directories may be different than yours my sfml folder is in c:\sfml\SFML-2.0-rc\

Thanks for your help.

[attachment deleted by admin]

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Problem Building the SFML 2.0 Release Candidate
« Reply #5 on: May 17, 2012, 10:16:42 pm »
You're linking to SFML dynamically, not statically. And you're mixing debug and release.

Please read the tutorial carefully :)
Laurent Gomila - SFML developer

diegonolan

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Problem Building the SFML 2.0 Release Candidate
« Reply #6 on: May 18, 2012, 01:37:20 am »
Thank's that fixed it.  Sorry for being so careless.