Sign in to follow this  
moaid

how to install external libraries on codeblocks

Recommended Posts

moaid    120

hi so i was trying to install things like sdl , allegro , sfml for a long time i followed many online tutorials but non seem to fit if some one could give me a tutorial or something to help me install sdl and/or sfml that would be great . im using windows 8 64 bit , codeblocks with the deafault compiler the gcc port (MinGW) . thanks biggrin.png

Share this post


Link to post
Share on other sites
Misantes    2092

Personally, when I was first learning to do this, I struggled quite a bit. It can get a little tricky depending on a few things, but is generally pretty straightforward (in hindsight).

 

I'll link to this for sfml using codeblocks and gcc/mingw, since it explains better than I could begin to and should get you up and running. You'll want to decide whether to use dynamic or static libraries. There's plenty of information out there, including this site, discussing the pros/cons of each.

 

For other libraries, you'll often have to build them first, which is a bit tricky the first few times as well. Though, plenty of tutorials out there explain building libraries.

Edited by Misantes

Share this post


Link to post
Share on other sites
Misantes    2092

Offhand, I'd say to make sure you're linking in the correct order (i.e. graphics, window, then system). Make sure you're setting things either globally, or make sure you're linking and compiling in the same mode (debug or release).

 

If you're trying to link statically, I'd recommend trying to get it up and running dynamically first, as static with sfml gets a little awkward as you need to link all the dependencies and include things with your project, amongst other things.

 

Lastly, you may want to build sfml yourself, if you're doing absolutely everything else correctly. I don't mean to complicate things further, but it's possible there are minor things keeping it from working for you that aren't due to user error (newer/older version of codeblocks, your version of gcc, etc, etc).

 

But, keep at it, you'll get it working, and sfml will make your life much easier (going by your thread on keyboard input).

Feel free to keep posting updates, I think most here can be sympathetic enough to keep walking you through it. It's a tough thing to get a handle on at first.

Share this post


Link to post
Share on other sites
Misantes    2092


Additionally my personal advise would be to start learning C++ with one of the MSVC Express editions when you are working on Windows to begin with. It's far easier to get working, precompiled binaries for most common libraries for that compiler. Using MinGW will in most cases require you to compile the libraries you need yourself. That is not a bad thing at all, but when you are starting out that's not something I recommend dealing with as well as everything else.

 

Great advice I think. In hindsight, I do recall having some issues on windows with codeblocks, mingw and sfml as well, and ended up just using visual studio. I had wanted to stay with codeblocks as it's what I use to compile on linux and I'm familiar with it, but once I tried to compile on windows, I had the damndest time with mingw/sfml/glfw/everything library-wise. I remember banging my head against the desk trying to get a mingw version working that supported c++14. Certainly some user-error on many of those fronts, I'm always a bit lost with all things windows :P I don't mean to bash anyone who maintains those libraries/compilers. But, ended up just doing visual studio and had a much easier time with things.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this