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

Author Topic: How to install SFML 1.6 with Code::Blocks ?  (Read 2500 times)

0 Members and 1 Guest are viewing this topic.

joaosausen

  • Newbie
  • *
  • Posts: 10
    • View Profile
How to install SFML 1.6 with Code::Blocks ?
« on: March 13, 2012, 09:18:48 pm »
Since i cant follow the actual tutorial in the site...
there is no "include" folder in c::b for example

im pretty newbie in this, a simple step by step will help a lot .

Thanks in advance.

Poraft

  • Newbie
  • *
  • Posts: 24
    • View Profile
How to install SFML 1.6 with Code::Blocks ?
« Reply #1 on: March 13, 2012, 09:57:10 pm »
I think you can better try to install v2.0 it's stable enough.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
How to install SFML 1.6 with Code::Blocks ?
« Reply #2 on: March 13, 2012, 10:34:37 pm »
Quote
there is no "include" folder in c::b for example

Then use the other solution explained in the tutorial.
Laurent Gomila - SFML developer

joaosausen

  • Newbie
  • *
  • Posts: 10
    • View Profile
How to install SFML 1.6 with Code::Blocks ?
« Reply #3 on: March 14, 2012, 12:05:21 am »
I tried the second solution too...
Still got this.

Code: [Select]
D:\Teste\teste\main.o:main.cpp|| undefined reference to `sf::Clock::Clock()'|
D:\Teste\teste\main.o:main.cpp|| undefined reference to `sf::Clock::GetElapsedTime() const'|
D:\Teste\teste\main.o:main.cpp|| undefined reference to `sf::Sleep(float)'|
D:\Teste\teste\main.o:main.cpp|| undefined reference to `sf::Clock::GetElapsedTime() const'|
||=== Build finished: 4 errors, 0 warnings ===|


trying to build the clock example..

sungchoiok

  • Newbie
  • *
  • Posts: 2
    • View Profile
How to install SFML 1.6 with Code::Blocks ?
« Reply #4 on: March 14, 2012, 04:59:04 am »
1st solution:

If you are using Linux, this had worked for me:

Quote
SFML-1.6/include/SFML(the entire folder) to /usr/include/
SFML-1.6/lib/<contents in it> to /usr/lib



2nd solution:

I think I know what you did wrong there--it stumped me too the first time.


(read the entire thing)
Quote
Leave the SFML files where you want, and setup Code::Blocks so that it can find them

Go to the Settings / Compiler and debugger menu, then to Global compiler settings / Search directories
In Compiler, add SFML-x.y\include
In Linker, add SFML-x.y\lib

Open your project's build options, then go to the Linker settings tab. In Other link options, add the SFML libraries you are using, with the "-l" directive. Here we only use libsfml-system.a, so we add "-lsfml-system". For the Debug configuration, you can link with the debug versions of the libraries, which have the "-d" suffix ("-lsfml-system-d" in this case).

This is for the dynamic version of the libraries, the one using the DLLs. If you want to link with the static version of the libraries, add the "-s" suffix : -lsfml-system-s, or -lsfml-system-s-d for the debug version.

When linking to multiple SFML libraries, make sure you link them in the right order, as it's important for MinGW. The rule is the following : if library XXX depends on (uses) library YYY, put XXX first and then YYY. An exemple with SFML : sfml-graphics depends on sfml-window, and sfml-window depends an sfml-system. The link options would be as follows :

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

Basically, every SFML library depends on sfml-system, and sfml-graphics also depends on sfml-window. That's it for dependencies.

Your program should now compile, link and run fine.



what I'm guessing is that you only followed up to the part that he had the picture of the source file. There are more instructions to follow after that.

joaosausen

  • Newbie
  • *
  • Posts: 10
    • View Profile
How to install SFML 1.6 with Code::Blocks ?
« Reply #5 on: March 14, 2012, 11:55:51 am »
yes. you are right...
i totally forgot the part after the picture.

Thank you.