SFML community forums

Help => General => Topic started by: thecheeselover on January 05, 2015, 12:58:06 am

Title: [Answered] Building "undefined references": SFML 2.2 32 bit MinGW gcc 4.7.1
Post by: thecheeselover on January 05, 2015, 12:58:06 am
(click to show/hide)

How my linking process work is that I link every optional libraries at the end of each build target, except for glew  because in 64 bit its name is glew32 (wtf Microsoft...). Then, in each build target, I add the respective link to each sfml libraries. For example, if it's a debug target, then I add -d but they all have -s. Also, depending on the architecture, I give the search directories for the linker:

[/list]
Title: Re: Building "undefined references": SFML 2.2 32 bit MinGW gcc 4.7.1
Post by: eXpl0it3r on January 05, 2015, 01:28:33 am
It seems to work fine on my end.

Are you absolutely certain that you're using the right libraries and Code::Blocks doesn't suddenly find other SFML libraries?
If you build SFML with SFML_USE_STATIC_STD_LIBS and a TDM compiler, you don't have to add -static-libgcc to the compiler flags. If you haven't checked that CMake option, you have to provide -shared-ligcc and -shared-libstdc++.
You can also remove your -DDGLEW_STATIC flag.
If you check SFML_BUILD_EXAMPLES when building SFML, do you get errors? If not, then it has to be an issue in your settings.
And last but not least, if you build the install target for static SFML, SFML's dependencies will get automatically copied to the lib and include directories, so you don't have to add the paths to the extlibs dir.
Title: Re: Building "undefined references": SFML 2.2 32 bit MinGW gcc 4.7.1
Post by: thecheeselover on January 05, 2015, 02:00:53 am
Quote
If you check SFML_BUILD_EXAMPLES when building SFML, do you get errors?

Nope, because I checked SFML_BUILD_DOC, SFML_BUILD_EXAMPLES and SFML_USE_STATIC_STD_LIBS. I remember that checking BUILD_SHARED_LIBS and SFML_USE_STATIC_STD_LIBS at the same times provoked errors, so I uncheked BUILD_SHARED_LIBS. Anyway, I don't want any dll; I just want static librairies.

Quote
Are you absolutely certain that you're using the right libraries and Code::Blocks doesn't suddenly find other SFML libraries?
Actually, I'm unsure. All the paths I use point to the new SFML 2.2, but is there a way they could point to an old SFML? :O For example, if SFML is in the PATH?

EDIT: I tried sfml-graphics-s-d and everything with absolute paths but nothing changes.

Quote
And last but not least, if you build the install target for static SFML, SFML's dependencies will get automatically copied to the lib and include directories, so you don't have to add the paths to the extlibs dir.

Hmmm it doesn't do that for me...
Title: Re: Building "undefined references": SFML 2.2 32 bit MinGW gcc 4.7.1
Post by: thecheeselover on January 05, 2015, 10:10:27 pm
Ok that's was really hard to find but, I guess that after installing multiple compilers, my PATH variable got mixed up. What happened is that CB's MinGW default compiler has been replaced by a TDM compiler. When I was using CMake, I was checking "Use default native compilers" when I should have given the old MinGW's g++ and gcc path. Now it works! :)