Where are the .a files in SFML 2.0?

Started by
13 comments, last by Zeldforged 10 years, 10 months ago

hello

i understood you were linking against the static lib

did you define the "SFML_STATIC" in the codeblock "defines"

good luck

Advertisement

Assuming you're using the default CodeBlocks GNU GCC compiler:

Download the SJLJ version of SFML 2.0 (32-bit)

Under project build options-> Linker settings, you should link these files in order:

sfml-graphics-s

sfml-window-s

sfml-system-s

Instead of the actual file name!

Now, add your SFML include folder in the Search Directories->Compiler tab

and the lib folder in Search Directories->Linker tab

Under Compiler settings->#defines

add this text: "SFML_STATIC" (without quotes)

Now the program should work, at least it did for me.

Your first batch of errors were undefined references to SFML functions, so that means your program could find the headers but not the .a files, or that you had the wrong .a files.

Your second batch of errors were undefined references to non-SFML functions. These functions were because even the same compiler (GCC/MinGW) can be compiled with different settings. The specific functions (which I know from prior googling when encountering the same problem), is because the library you downloaded is compiled using one type of compiled settings for exception handling, and the compiler you are using is compiled using a different type of settings for exception-handling.

Your third set of errors, which is your first set of errors again, is saying that it can't find certain SFML functions.

Because you are linking to the SFML libraries statically, wassime mentioned that you need to define 'SFML_STATIC' in your compiler settings. See here. That page actually describes your 2nd problem also... but that was resolved when you recompiled SFML from scratch.

"Honestly I should be able to understand this but, c'mon, I just want to display a blue circle."

You are encountering standard C++ frustrations, so, for the record, these problems aren't really SFML-specific.

You'll encounter these kind of issues even after years of C++ experience. Or, at least I do.

Some of these issues may hopefully get addressed in future C++ standards, but others likely won't.

You'll learn to interpret these errors also... but sometimes an error can mean one of half a dozen different problems. Future C++ compilers are working on improving the readability of compiler error messages.

tldr: I think wassime is correct.

Thanks for all the input and contribution to my problem guys!
The problem ended up being that none of the builds were compatible with my compiler. I needed to download a Nightly Build. I simply replaced the contents of the Nightly SFML with the ones in the current directory, rebuilt my C++ file and everything is working now.

My circle is on screen and I'm ready to sell it to Microsoft for a mere $120,000,000 and the rights to Halo.

Congrats mate! Every time you find a solution in a problem that gets you crazy, write the solution somewhere (like explaining it to children: step1,2,3,4 etc) or post it in your blog or something. Someone else might have the same problem or you might face it again, sometime later.

Well done ;)

This topic is closed to new replies.

Advertisement