Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Where are the .a files in SFML 2.0?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
14 replies to this topic

#1 Exoaria   Members   -  Reputation: 167

Like
0Likes
Like

Posted 28 June 2013 - 03:28 AM

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.


Edited by Exoaria, 28 June 2013 - 05:23 AM.


Sponsor:

#2 BitMaster   Crossbones+   -  Reputation: 4228

Like
0Likes
Like

Posted 28 June 2013 - 04:27 AM

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.

#3 Exoaria   Members   -  Reputation: 167

Like
0Likes
Like

Posted 28 June 2013 - 04:42 AM

 

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)



#4 BitMaster   Crossbones+   -  Reputation: 4228

Like
0Likes
Like

Posted 28 June 2013 - 05:12 AM

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.



#5 jbadams   Senior Staff   -  Reputation: 19040

Like
1Likes
Like

Posted 28 June 2013 - 06:28 AM

//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.


Edited by jbadams, 28 June 2013 - 06:35 AM.


#6 BitMaster   Crossbones+   -  Reputation: 4228

Like
1Likes
Like

Posted 28 June 2013 - 06:30 AM

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.

#7 jbadams   Senior Staff   -  Reputation: 19040

Like
0Likes
Like

Posted 28 June 2013 - 06:34 AM


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

Thanks for the correction!



#8 Exoaria   Members   -  Reputation: 167

Like
0Likes
Like

Posted 28 June 2013 - 06:36 AM

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


Edited by Exoaria, 28 June 2013 - 06:49 AM.


#9 BitMaster   Crossbones+   -  Reputation: 4228

Like
0Likes
Like

Posted 28 June 2013 - 07:19 AM

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. 



#10 StoneArcher   Members   -  Reputation: 104

Like
0Likes
Like

Posted 28 June 2013 - 08:19 AM

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



#11 wassime   Members   -  Reputation: 107

Like
1Likes
Like

Posted 28 June 2013 - 08:25 AM

hello

i understood you were linking against the static lib

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

good luck



#12 Kenric   Members   -  Reputation: 118

Like
0Likes
Like

Posted 28 June 2013 - 09:27 AM

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.


Edited by Kenric, 28 June 2013 - 09:30 AM.


#13 Servant of the Lord   Crossbones+   -  Reputation: 20287

Like
1Likes
Like

Posted 28 June 2013 - 09:30 AM

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.


It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.
All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.
Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal

[Fly with me on Twitter] [Google+] [My broken website]

[Need web hosting? I personally like A Small Orange]


#14 Exoaria   Members   -  Reputation: 167

Like
2Likes
Like

Posted 28 June 2013 - 05:20 PM

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.



#15 Panos Georgiadis   Members   -  Reputation: 150

Like
0Likes
Like

Posted 29 June 2013 - 03:46 AM

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 ;)






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS