Where are the .a files in SFML 2.0?

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

I am trying to use Code::Blocks to write up my supernoob first 2D graphics of a deformed excuse for a shape on my screen.

All seemed to be well and good, I added the SFML-2.0\include\ folder and followed the documentation for my incredible green circle, my IDE was smiling brightly upon me as I it recognized the RenderWindow term and allowed me to place in parameters without proceeding to mock me by filling my log up with red text and references to objects that I never even wrote. Upon excitedly hitting the F9 key to build and run my new AAA game that was going to make me millions of dollars and revolutionize the market, I was finally spammed with the sadistic shit that the IDE was taking pleasure in letting out on me with an error message on almost every line.

It's relatively the same error each time:

sFdXibA.png

Anyway. Some Google searches suggested that I hadn't placed in the appropriate library files (I had linked to the .lib's beforehand) and so I went on to fix my problem based on my own incompetence when... there's no ".a files" at all. It clearly suggests that they are in the lib folder. But there are only the basic libraries (system, system-s, system-d, window-s etc.) in .lib format.

If I can't even figure this one out I might as well seek a new career line as a catholic priest. So someone please tell me what the heck I'm doing wrong before I repent to the good lord for all my wrongs and move to Russia where I can spank mutant deer with my new acquired religious friends. You guys are about to determine my future.

Advertisement

It's relatively the same error each time:
'undefined reference to `_imp___ZN2kfjalCOLORskfjaCOMMUNISTSsfllRENDERTARGETasfkPOLLjsfhjdCHILDSUPPORTsRNS_fkhsfaBLUEkljghf'


I assume you found it 'funny' to modify this error. Because if not, whatever is missing has nothing to do with SFML.

Never modify error messages. Always post them verbatim.

For the actual problem, either download the correct distribution of SFML for your compiler or build it yourself.

As a side node, this problem has nothing to do with graphics programming. It's purely a basic library issue.

It's relatively the same error each time:
'undefined reference to `_imp___ZN2kfjalCOLORskfjaCOMMUNISTSsfllRENDERTARGETasfkPOLLjsfhjdCHILDSUPPORTsRNS_fkhsfaBLUEkljghf'


I assume you found it 'funny' to modify this error. Because if not, whatever is missing has nothing to do with SFML.

Never modify error messages. Always post them verbatim.

For the actual problem, either download the correct distribution of SFML for your compiler or build it yourself.

As a side node, this problem has nothing to do with graphics programming. It's purely a basic library issue.

I think that for anyone after spending days upon days sitting in front of a screen trying to understand the headache of C++ and OpenGL you will do absolutely anything to try and lighten the load. However in case I needed to reiterate, I got about 50 error messages upon trying to compile them, all starting with `_imp___ and then followed by lots of gibberish with random words inserted into them. If you'd like to see them all in their non-hilarious format, that's super. Here they are.

sFdXibA.png

Personally I prefer the communist child support alterations.

Anyway, I had no idea this was not related to Graphics Programming. I have not had this issue at all until I tried to use Code::Blocks with SFML.
I just want to know where the .a files are, then I'll leave you alone and go buy some kittens. (SFML 2.0 is perfectly compatible with Code::Blocks and the GNU GCC Compiler)

You are asking other people to help you, but at the same time you are actively sabotaging their attempts to do so by supplying fake information. Just because you cannot read the strings does not mean no one else can. And while I'm very far from an expert of individual compiler's C++ name mangling, just be glancing at the strings you can verify it's indeed SFML functions missing. I suggest for the future to try and find humour in things that do not actively sabotage other people's attempt to help you.

Nevertheless, the solution of my original post still stand: download whichever precompiled distribution is for your compiler or build the library yourself. I do not know if there is a precompiled distribution of SFML for your preferred flavour of MinGW, but the last time I tried it compiling it yourself was extremely easy.

//EDIT: See the correction offered below.

Different operating systems follow different naming conventions for certain file types -- the .lib files you're seeing are the files you need on Windows, and the information you're seeing online about .a files refers to the same files on Linux or Unix systems.

BitMaster's suggested solution to your problem is correct. You will need to install the correct distribution for your compiler and OS and correctly configure Code::Blocks, or alternatively build the library yourself, and then configure Code::Blocks to use the resulting files. The errors you're seeing indicate that SFML has not been included in your project correctly.

- Jason Astle-Adams

Different operating systems follow different naming conventions for certain file types -- the .lib files you're seeing are the files you need on Windows, and the information you're seeing online about .a files refers to the same files on Linux or Unix systems.


Actually, when using MinGW or its derivatives most libraries will obey the libXXX.a pattern even on Windows.


Actually, when using MinGW or its derivatives most libraries will obey the libXXX.a pattern even on Windows.

Thanks for the correction!

- Jason Astle-Adams

Alright, thanks BitMaster. I get where I was going wrong now, I didn't understand that those errors were telling me I was using a version of SFML for my wrong compiler.
After downloading the MinGW version I am faced with a new dilemma. I've linked them all correctly, however:

pGys9k8.png

I don't even know.
Honestly I should be able to understand this but, c'mon, I just want to display a blue circle.
My computer hates me.

I'm sure that I've put everything in its right space though.

EDIT: Okay, I rebuilt it and now I'm not getting the error above anymore. But now I'm getting the errors seen in the original post again! Except this time I've linked up the .a files and everything seems to be set using the MinGW version.

EDIT 2: Here's everything as it should be, and you can see the errors down below.

X2PyMHW.png

Please do not post screenshots, copy and paste the actual errors. I don't have a Code::Blocks here but one of the panes displays the actual compiler output and allows easy copy and pasting. Take special note of any warnings that are generated before the errors are generated.

If a rebuild completely changes the kind of linker problems you get like this, that suggests you have done something wrong or at least fishy. How is that project generated? Directly modifying the Code::Blocks settings will generally not be possible if the project is automatically generated by CMake for example.

Do you have access to the Makefile? I am sure that there is a nifty way of adding the library directories to the codeblocks config, but I am unfamiliar with codeblocks.

You should have a -L flag in the linking line of the makefile, if the libs are not in the usual place for your OS. If you built the libraries yourself, you may have forgot to install them. Typically installing the libs will place them correctly.

Have you checked out the sfml-dev.org site? It is a wealth of info on getting up and running with SFML.

http://en.sfml-dev.org/forums/index.php?topic=10971.msg75687

This topic is closed to new replies.

Advertisement