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

Author Topic: [SOLVED]Undefined reference to blahblahblah in CodeBlocks  (Read 11479 times)

0 Members and 1 Guest are viewing this topic.

Zanaran

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
[SOLVED]Undefined reference to blahblahblah in CodeBlocks
« on: April 16, 2015, 03:55:16 am »
There are several people out there with the same problem as me, but the solutions they were given were either unclear or didn't help me.
I am using Windows 7 x86, Code Blocks Release 12.11 rev 8629, and SFML 2.2 GCC 4.8.1 TDM (SJLJ) - 32-bit. I have followed the instructions of the tutorial as best as I could but I still get this in the build log:

(click to show/hide)

I set the compiler and linker search directories to be global for both debug and release, and same for the dependencies that I used.

The settings for the debug and release are the same except for the -d suffix which is only for debug.

And I globally defined static under Compiler settings > #defines.

The code I wanted to compile is the same as the tutorial code.
(click to show/hide)

Did I do anything wrong here? Is there something I didn't mention also?

SOLVED: Solution is here for anyone who has the same problem:
These in your project-wide linker settings:
  • glew
  • freetype
  • jpeg
  • opengl32
  • gdi32
  • winmm
These in your debug build target settings:
  • sfml-graphics-s-d
  • sfml-window-s-d
  • sfml-system-s-d
These in your release build target settings:
  • sfml-graphics-s
  • sfml-window-s
  • sfml-system-s
Don't forget to change the linker policy of your targets to Prepend target options to project options, as I showed in the picture I posted.
« Last Edit: April 17, 2015, 02:52:16 am by Zanaran »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
AW: Undefined reference to blahblahblah in CodeBlocks
« Reply #1 on: April 16, 2015, 09:25:50 am »
The order is wrong. I've personally not found a way to tell where the global libs should be added. As such you'll have to add all the global libs to debug and release instead.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: AW: Undefined reference to blahblahblah in CodeBlocks
« Reply #2 on: April 16, 2015, 09:59:16 am »
The order is wrong. I've personally not found a way to tell where the global libs should be added. As such you'll have to add all the global libs to debug and release instead.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: Undefined reference to blahblahblah in CodeBlocks
« Reply #3 on: April 16, 2015, 10:12:04 am »
Oh. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Zanaran

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: AW: Undefined reference to blahblahblah in CodeBlocks
« Reply #4 on: April 17, 2015, 01:18:45 am »
The order is wrong. I've personally not found a way to tell where the global libs should be added. As such you'll have to add all the global libs to debug and release instead.
I followed your instructions and put the libraries back where they should be but now I get a DLL error because apparently I'm missing OpenGL32. What do I do now?

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Undefined reference to blahblahblah in CodeBlocks
« Reply #5 on: April 17, 2015, 02:20:27 am »
Show the new build log.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Zanaran

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Undefined reference to blahblahblah in CodeBlocks
« Reply #6 on: April 17, 2015, 02:28:30 am »
Shoot, was about to say.
(click to show/hide)

G.

  • Hero Member
  • *****
  • Posts: 1592
    • View Profile
Re: Undefined reference to blahblahblah in CodeBlocks
« Reply #7 on: April 17, 2015, 02:33:37 am »
Your linking order is still wrong, and now you're linking SFML twice! Dependencies should come after libs that are dependent of them.

Zanaran

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Undefined reference to blahblahblah in CodeBlocks
« Reply #8 on: April 17, 2015, 02:37:08 am »
This is the linking order that I have:

Did I mess something up or is there a better way to link like this?

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Undefined reference to blahblahblah in CodeBlocks
« Reply #9 on: April 17, 2015, 02:40:15 am »
These in your project-wide linker settings:
  • glew
  • freetype
  • jpeg
  • opengl32
  • gdi32
  • winmm
These in your debug build target settings:
  • sfml-graphics-s-d
  • sfml-window-s-d
  • sfml-system-s-d
These in your release build target settings:
  • sfml-graphics-s
  • sfml-window-s
  • sfml-system-s
Don't forget to change the linker policy of your targets to Prepend target options to project options, as I showed in the picture I posted.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Zanaran

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Undefined reference to blahblahblah in CodeBlocks
« Reply #10 on: April 17, 2015, 02:50:18 am »
These in your project-wide linker settings:
  • glew
  • freetype
  • jpeg
  • opengl32
  • gdi32
  • winmm
These in your debug build target settings:
  • sfml-graphics-s-d
  • sfml-window-s-d
  • sfml-system-s-d
These in your release build target settings:
  • sfml-graphics-s
  • sfml-window-s
  • sfml-system-s
Don't forget to change the linker policy of your targets to Prepend target options to project options, as I showed in the picture I posted.
Just did it, and finally, it worked!

Thanks a ton, by the way. I spent about two days trying to figure this out and now I feel dumb.