I Need Help In SFML Project

Try to compile SFML from source and re-verify the project setup guide, just in-case the compiler version you're using is different to the binaries provied.
i do Every Tihng But Get the Same Error
It doesn't look like you're linking to the libs.

Go in your project settings and add the appropriate sfml libs to your project's linker settings (ie: "sfml_system.lib", etc).

Or... if you don't know how to do that and/or would rather avoid having to do that for all your SFML projects, you can do what I do and create a general purpose sfml header that links the libs automatically through pragmas.

This will work for Visual Studio (which it looks like you are using):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef SFMLFULL_INCLUDED
#define SFMLFULL_INCLUDED

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

#if defined(_DEBUG) || defined(DEBUG)
    #ifdef SFML_STATIC
        #pragma comment(lib,"sfml-graphics-s-d.lib")
        #pragma comment(lib,"sfml-audio-s-d.lib")
        #pragma comment(lib,"sfml-network-s-d.lib")
        #pragma comment(lib,"sfml-window-s-d.lib")
        #pragma comment(lib,"sfml-system-s-d.lib")
    #else
        #pragma comment(lib,"sfml-graphics-d.lib")
        #pragma comment(lib,"sfml-audio-d.lib")
        #pragma comment(lib,"sfml-network-d.lib")
        #pragma comment(lib,"sfml-window-d.lib")
        #pragma comment(lib,"sfml-system-d.lib")        
    #endif
    #pragma comment(lib,"sfml-main-d.lib")
#else
    #ifdef SFML_STATIC
        #pragma comment(lib,"sfml-graphics-s.lib")
        #pragma comment(lib,"sfml-audio-s.lib")
        #pragma comment(lib,"sfml-network-s.lib")
        #pragma comment(lib,"sfml-window-s.lib")
        #pragma comment(lib,"sfml-system-s.lib")
    #else
        #pragma comment(lib,"sfml-graphics.lib")
        #pragma comment(lib,"sfml-audio.lib")
        #pragma comment(lib,"sfml-network.lib")
        #pragma comment(lib,"sfml-window.lib")
        #pragma comment(lib,"sfml-system.lib")        
    #endif
    #pragma comment(lib,"sfml-main.lib")
#endif


#endif // SFMLFULL_INCLUDED 



Save that to a file somewhere. I have it saved as "sfml.h". I put it wherever the SFML include directory is.

Then, in your program... instead of doing:

#include <SFML/Graphics.hpp>

You can just do:

#include <sfml.h>

And you're done.
Last edited on
Topic archived. No new replies allowed.