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

Author Topic: Can't get SFML to work in codeblocks  (Read 2963 times)

0 Members and 1 Guest are viewing this topic.

NGM88

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Can't get SFML to work in codeblocks
« on: January 21, 2017, 09:41:41 pm »
Here's what I have done so far, step by step:

1- downloaded codeblocks-16.01mingw-setup and installed it. codeblocks is working fine.

2- downloaded GCC 4.9.2 TDM (SJLJ) - 32-bit and put it in C:\SFML-2.4.1

3- created an empty project in codeblocks

4- went to Project -> Build Options.

selected the project name from the left menu so that the settings are global (applying to both Debug and Release).

added "C:\SFML-2.4.1\include" under Search Directories -> Compiler

added "C:\SFML-2.4.1\lib" under Search Directories -> Linker

said No to "Keep this as relative path?" on both occasions.

5- selected Debug from the left menu.

went to Linker Settings, added:

sfml-graphics-s-d
sfml-window-s-d
sfml-system-s-d

6- selected Release from the left menu.

went to Linker Settings, added:

sfml-graphics-s
sfml-window-s
sfml-system-s

7- selected the project name from the left menu (global settings)

went to Compiler Settings -> #defines and typed SFML_STATIC in the box.

8- clicked File -> New -> Empty File. Clicked Yes to add the file to the active project.

named it main.cpp and pasted the test code from http://www.sfml-dev.org/tutorials/2.4/start-cb.php into it.

When I run the program I get a ton of "undefined reference to ..." errors. too many to post here.

SFML website says I need to add the opengl32, freetype, jpeg, gdi32 and winmm dependencies under Linker Settings.

I tried this ordering for Debug and the same ordering without "-d"s for Release, but it DIDN'T WORK:

sfml-graphics-s-d
sfml-window-s-d
opengl32
freetype
jpeg
gdi32
sfml-system-s-d
winmm

in what EXACT ORDER do I need to add them?

Also, do I need to add other specific search directories for these to work?

Mr_Blame

  • Full Member
  • ***
  • Posts: 192
    • View Profile
    • Email
Re: Can't get SFML to work in codeblocks
« Reply #1 on: January 22, 2017, 03:23:31 pm »
Which functions are marked as undefined in particular?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Can't get SFML to work in codeblocks
« Reply #2 on: January 22, 2017, 07:57:32 pm »
Always include the full error message. It's not just an annoying mess of characters, but it tells you exactly what is wrong, all you need to practice is understanding how to interpret them. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/