SFML community forums

Help => General => Topic started by: Spankenstein on August 21, 2012, 01:33:48 pm

Title: Problems setting up SFML RC2.0 VS2010
Post by: Spankenstein on August 21, 2012, 01:33:48 pm
I have downloaded the RC version of SFML for Visual Studio C++ 2010 http://www.sfml-dev.org/download/2.0-rc/SFML-2.0-rc-windows-32-vc2010.zip (http://www.sfml-dev.org/download/2.0-rc/SFML-2.0-rc-windows-32-vc2010.zip)

I have followed the instructions on this page for the static library linking.

I have created a new console project with the code from the setup guide:

#include "stdafx.h"
#include <SFML/Graphics.hpp>

int _tmain(int argc, _TCHAR* argv[])
{
        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;
}
 

I will not compile because of the following error:


Error   1   error LNK2001: unresolved external symbol "public: static class sf::RenderStates const sf::RenderStates::Default" (?Default@RenderStates@sf@@2V12@B)


I have cleaned and rebuilt the project and it doesn't solve the issue.

I have a NVIDIA GeForce GTX680 graphics card with the latest drivers.

I'm running Windows 7 64-bit#

All configurations include 'SFML_STATIC' as a preprocessor definition.
Title: Re: Problems setting up SFML RC2.0 VS2010
Post by: eXpl0it3r on August 21, 2012, 01:39:57 pm
And you're linking against all the needed sfml libraries (as descriped in the tutorial (http://www.sfml-dev.org/tutorials/2.0/start-vc.php))?

Btw it's adviced to create any empty project and start from there without the precompiled stuff (i.e. stdafx.h). ;)
Title: Re: Problems setting up SFML RC2.0 VS2010
Post by: Spankenstein on August 21, 2012, 02:08:30 pm
Quote
Btw it's adviced to create any empty project and start from there without the precompiled stuff (i.e. stdafx.h)

#include <SFML/Graphics.hpp>

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;
}
 

That's done.

Quote
And you're linking against all the needed sfml libraries (as descriped in the tutorial)?

Yes.  Example:

(http://www.rhysperkins.com/XNA/LinkingSFML.png)
Title: Re: Problems setting up SFML RC2.0 VS2010
Post by: eXpl0it3r on August 21, 2012, 02:13:00 pm
Hmm read the tutorial again. There are diffrent types of libraries:
So you're using dynamic libraries but try to link statically this does obviously not work. ;)
Title: Re: Problems setting up SFML RC2.0 VS2010
Post by: Spankenstein on August 21, 2012, 02:59:05 pm
Ah I see.  A small but important oversight on my behalf! :)

Thank you for pointing that out.

I'm getting lots of warnings along the lines of:


Warning   28   warning LNK4099: PDB 'sfml-window-s-d.pdb' was not found with 'sfml-window-s-d.lib(WindowImplWin32.cpp.obj)' or at 'some\other\directory'; linking object as if no debug info


Are they easy to fix?
Title: Re: Problems setting up SFML RC2.0 VS2010
Post by: eXpl0it3r on August 21, 2012, 03:02:58 pm
The SFML binaries do not ship with the debug information (= pdb file) thus if an error occures in SFML (which shouldn't happen anyways) the debugger wouldn't really be able to jump in. You can safely ignore those warnings or even disable it by adding /ignore:4099 to the linker settings. ;)
Title: Re: Problems setting up SFML RC2.0 VS2010
Post by: Spankenstein on August 21, 2012, 03:41:24 pm
The /IGNORE: doesn't work for additional options on the command line.

Can I generate the .pdb file by rebuilding from source?
Title: Re: Problems setting up SFML RC2.0 VS2010
Post by: eXpl0it3r on August 21, 2012, 03:42:57 pm
The /IGNORE: doesn't work for additional options on the command line.
What? ???

Can I generate the .pdb file by rebuilding from source?
Sure if you rebuild from source (and don't delete the pdb files) then you'll get them. :)
Title: Re: Problems setting up SFML RC2.0 VS2010
Post by: Spankenstein on August 21, 2012, 04:02:12 pm
Quote
What?

See: http://stackoverflow.com/questions/661606/visual-c-how-to-disable-specific-linker-warnings (http://stackoverflow.com/questions/661606/visual-c-how-to-disable-specific-linker-warnings)

Thank you for your help in getting me started.  'tis much appreciated :)