SFML not registering?

So I am just getting started with SFML, and as soon as I set up SFML with code:blocks and try to create a simple window, I get errors, as if it doesn't know about SFML.

When I run This code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  #include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow Window;
    Window.create(sf::VideoMode(800,600),"Element 71");

    while (Window.isOpen())
    {
        sf::Event Event;
        while(Window.pollEvent(Event))
        {
            if(Event.type == sf::Event::Closed)
                Window.close();
        }
    }
}


I get all these errors.
obj\Debug\main.o||In function `main':|
C:\Users\Owner\Documents\C++\Color Clicker\main.cpp|5|undefined reference to `_imp___ZN2sf12RenderWindowC1Ev'|
C:\Users\Owner\Documents\C++\Color Clicker\main.cpp|6|undefined reference to `_imp___ZN2sf6StringC1EPKcRKSt6locale'|
C:\Users\Owner\Documents\C++\Color Clicker\main.cpp|6|undefined reference to `_imp___ZN2sf9VideoModeC1Ejjj'|
C:\Users\Owner\Documents\C++\Color Clicker\main.cpp|6|undefined reference to `_imp___ZN2sf6Window6createENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE'|
C:\Users\Owner\Documents\C++\Color Clicker\main.cpp|14|undefined reference to `_imp___ZN2sf6Window5closeEv'|
C:\Users\Owner\Documents\C++\Color Clicker\main.cpp|11|undefined reference to `_imp___ZN2sf6Window9pollEventERNS_5EventE'|
C:\Users\Owner\Documents\C++\Color Clicker\main.cpp|8|undefined reference to `_imp___ZNK2sf6Window6isOpenEv'|
C:\Users\Owner\Documents\C++\Color Clicker\main.cpp|16|undefined reference to `_imp___ZN2sf12RenderWindowD1Ev'|
C:\Users\Owner\Documents\C++\Color Clicker\main.cpp|16|undefined reference to `_imp___ZN2sf12RenderWindowD1Ev'|
||=== Build finished: 9 errors, 0 warnings (0 minutes, 1 seconds) ===|

Im guessing I screwed up on the set-up, dont really know where though....
I am using SFML 2.0 GCC

Ask for any other info
You are not linking to the lib files.

I forget how to do this in C::B, but in your project settings there should be a place where you can add additional libs to the project. You probably need to add the below:

lsfml-graphics
lsfml-window
lsfml-system
lsfml-main


If you want to statically link instead of dynamically link... add "-s" to the end of all of those (except lsfml-main). ie "lsfml-graphics-s"

For debug builds, add a "-d" to the end of that. ie "lsfml-graphics-s-d" or just "lsfml-graphics-d"
Did you follow http://sfml-dev.org/tutorials/2.0/start-cb.php ?

It would appear from the errors that you aren't linking to the SFML libraries.
Thanks Cire and Disch, I thought if you added the base you didnt have to add the individual folders.

**Solved
Topic archived. No new replies allowed.