SFML Very Confusing

1. On the sfml tutorial for using visual studio, it wants you to link all 5 modules (graphics, audio, window, network, ect). There is a picture of what it should look like. It says that under c++>>linker>>input>>additional dependencies on release mode it should say "sfml-graphics.lib sfml-window.lib sfml-systen.lib sfml-network.lib sfml-audio.lib kernel3". On a video I watched it wanted me to put more than that. Is the one on the website correct?

2. Underneath the picture of what your supposed to put, it has a warning:
It is important to link to the libraries that match the configuration: "sfml-xxx-d.lib" for Debug, and "sfml-xxx.lib" for Release. A bad mix may result in crashes.

3. I'm not sure if my library is correct because whenever I try t debug it it says that the file can't be found. The error reads: Error 1 error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'. The file reads "C:\Users\Jace\documents\visual studio 2012\Projects\SFML Test\SFML Test\sfml-graphics-d.lib(sfml-graphics-d-2.dll)"


Should I change anything? Does this affect what I should put in my library? Thank you for all help!
Last edited on
You have to link to the lib that matches the configuration.
sfml-*.lib -- release DLL
sfml-*-s.lib -- release static
sfml-*-d.lib -- debug DLL
sfml-*-s-d.lib --debug static

So for debug dynamic build (VS defaults to dynamic) link the debug DLL libs and for realease the release DLL libs.

I personally link statically on windows so I don't have to move DLLs around, but it requires more settings changes.
You're using x64 libs on a x86 machine. Just redownload the SFML lib for Visual Studio x86
The version I was using was SFML 2.1 for visual C++ 2012 64-bit for windows. I deleted that and am now using a 32-bit. When I debug it, it says it can't find the .exe, but I had previously hit the save all button.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#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;
}  


This is my .cpp. I don't have a header file, but I think I'm supposed to. One of the errors says "cannot open SFML/Graphics.hpp. No such file or directory"



I'm not sure if my libraries are correct, but even if they weren't, shouldn't it at least be able to find th header file?
Last edited on
Topic archived. No new replies allowed.