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

Author Topic: Can't get the tutorial to work in CodeBlocks (undefined reference errors)  (Read 1982 times)

0 Members and 1 Guest are viewing this topic.

fluffymoochicken

  • Newbie
  • *
  • Posts: 2
    • View Profile
I'm using CodeBlocks ver. 13.12 with GCC 4.7.1 TDM installed. I downloaded the SFML 2.3 GCC 4.7.1 TDM (SJLJ) - 32-bit file from the Downloads section. I followed all of the tutorial steps exactly and made sure to have the libraries in the proper order.

Here was the build command (I switched to using the debug versions to see if that would make SFML work):

Code: [Select]
mingw32-g++.exe -LC:\SFML-2.3\lib -o bin\Debug\SFML_testing.exe obj\Debug\main.o   -lsfml-graphics-d -lsfml-window-d -lsfml-system-d
Got a whole list of undefined reference errors like this one:
Code: [Select]
undefined reference to `_imp___ZN2sf6StringC1EPKcRKSt6locale'
I've searched your forums for other threads where people had this problem, but none of the solutions given have worked for me at all yet.

I don't know how or why it isn't working, so any help would be much appreciated.

kitteh-warrior

  • Guest
Which tutorial?

The fact that you are getting "_imp___ZN2sf6StringC1EPKcRKSt6locale", means that is it an implied reference. Are you defining "SFML_STATIC", while using the dynamic libraries, or not when using the static libraries?
« Last Edit: July 06, 2015, 01:57:04 pm by kitteh-warrior »

lorence30

  • Full Member
  • ***
  • Posts: 124
    • View Profile
    • Email
you must be linking wrong.
try this
http://www.edparrish.net/common/sfmlcb.html

fluffymoochicken

  • Newbie
  • *
  • Posts: 2
    • View Profile
Which tutorial?

The fact that you are getting "_imp___ZN2sf6StringC1EPKcRKSt6locale", means that is it an implied reference. Are you defining "SFML_STATIC", while using the dynamic libraries, or not when using the static libraries?
This tutorial:
http://www.sfml-dev.org/tutorials/2.1/start-cb.php

And no, I am not defining SFML_STATIC.

you must be linking wrong.
try this
http://www.edparrish.net/common/sfmlcb.html
Followed this tutorial exactly as it's written, step by step, and it changed nothing. I'm still getting the same "undefined reference" errors.

I notice that this tutorial was written for version 2.2, though. Perhaps I should try downgrading?

kitteh-warrior

  • Guest
This tutorial:
http://www.sfml-dev.org/tutorials/2.1/start-cb.php

Quote from: fluffymoochicken
this tutorial was written for version 2.2

That tutorial was written for version 2.1 ;)  (look at the link's address)
If you are using 2.3, use this link.
2.2, use this link.
2.1, use this link.
etc.

Going to SFML's homepage, clicking Learn (at the top navigation bar), and clicking Tutorials will bring you to the most current version of SFML's official tutorials.