SFML community forums

Help => General => Topic started by: fluffymoochicken on July 05, 2015, 11:37:29 pm

Title: Can't get the tutorial to work in CodeBlocks (undefined reference errors)
Post by: fluffymoochicken on July 05, 2015, 11:37:29 pm
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.
Title: Re: Can't get the tutorial to work in CodeBlocks (undefined reference errors)
Post by: kitteh-warrior on July 06, 2015, 01:25:41 pm
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?
Title: Re: Can't get the tutorial to work in CodeBlocks (undefined reference errors)
Post by: lorence30 on July 06, 2015, 05:28:07 pm
you must be linking wrong.
try this
http://www.edparrish.net/common/sfmlcb.html
Title: Re: Can't get the tutorial to work in CodeBlocks (undefined reference errors)
Post by: fluffymoochicken on July 09, 2015, 07:09:59 am
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?
Title: Re: Can't get the tutorial to work in CodeBlocks (undefined reference errors)
Post by: kitteh-warrior on July 09, 2015, 11:51:29 am
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 (http://www.sfml-dev.org/tutorials/2.3/).
2.2, use this link (http://www.sfml-dev.org/tutorials/2.2/).
2.1, use this link (http://www.sfml-dev.org/tutorials/2.1/).
etc.

Going to SFML's homepage (http://www.sfml-dev.org/index.php), clicking Learn (http://www.sfml-dev.org/learn.php) (at the top navigation bar), and clicking Tutorials (http://www.sfml-dev.org/tutorials) will bring you to the most current version of SFML's official tutorials.