Jump to content

View more

Image of the Day

Adding some finishing touches...
Follow us for more
#screenshotsaturday #indiedev... by #MakeGoodGames https://t.co/Otbwywbm3a
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Sign up now

CodeBlocks and SFML Confusion?

4: Adsense

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
7 replies to this topic

#1 Saint Squireen   Members   


Posted 24 December 2012 - 10:03 PM



    My problem is that I have been trying to link SFML with codeblocks and I can never seem to be able to do it. The first time I have ever tried this was probably a year ago, when I was first learning C++.


I tried and I couldn't do it.


I decided that maybe I was too new in the programming world anyways to try this SFML thing out. So I waited a bit and tried again. Didn't work. Couldn't make sense of what I was doing, didn't know if it was working....


Again I waited,


and again I failed.


So now I'm thinking, "There has got to be an easier way of doing this..." I come up with the idea that maybe somebody has made a video tutorial on how to link up SFML and codeblocks. So I go and search, find nothing, but still the idea that if somebody had made a video tutorial, the how in the world could I mess up linking and compiling it together?


That's when I came here. Before you go ahead and tell me I'm such a dumbass, that SFML is one of the easiest ones to work with, understand that I am young and don't have any clue on what I was doing when I was trying to work with SFML.



Now the real qestion: Does anybody know where a guy can find a video tutorial on how to put codeblocks and SFML together? Can someone take time out of their day and make one perhaps?



Anything to help would be appreciated and any questions regarding anything, just ask below.

~Saint Squireen

#2 BeerNutts   Members   


Posted 24 December 2012 - 10:28 PM

Have you looked at the tutorial provided at the SFML site? Click here for site.


Also, I put together some images for setting up projects to use SFML, maybe it will help.  Click here for them.


If so, what are you having trouble with?

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

#3 Saint Squireen   Members   


Posted 24 December 2012 - 11:29 PM

Yeah, I've tried the websites tutorial and that's what I've been having a hard time on.


Also I looked at your pictures, and I did all that they said (except for the ones that had the extra stuff like the physics engine) and I built and ran it and it gave me...



mingw32-g++.exe: lsfml-window: No such file or directory
mingw32-g++.exe: lsfml-network: No such file or directory
mingw32-g++.exe: lsfml-audio: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

~Saint Squireen

#4 Aldacron   GDNet+   


Posted 25 December 2012 - 02:25 AM

CodingMadeEasy has a number of SFML tutorials on YouTube. His seem to be the most comprehensive. I also typed "SFML Tutorial" into the search box at YouTube and came back with a number of hits from different users, but I recommend you go with the CodingMadeEasy series.


Being able to configure a development environment is a very essential skill in programming. As you work your way through that first video, I recommend that you take the time to fully understand why you have to configure each option the way you do. One way to do that is to read a book about GCC (since you are using MinGW, the Windows port of the compiler). You can read an introductory text online for free. If you work through that book and learn how to use the compiler from the command line, then the IDE options will make a whole lot more sense to you and you'll be able to more easily solve configuration problems in the future.

#5 MrDaaark   Members   


Posted 25 December 2012 - 03:10 AM

<br />A library is just a collection of pre-written code that someone else wrote to achieve a certain task. You can't really install them into anything. You just put them in a folder somewhere.<br /><br />When you compile an executable using a library, the compiler needs to know where to find the header files you included, and then the linker needs to know where to find any libraries you will be linking to.<br /><br />There are different ways to do this. You might type them right in on the command line when you call your compiler and linker. Or you might include the folders in the PATH environment variable for your OS.<br /><br />In an IDE, there are settings to include these paths. Both globally, and on a per project basis. In Code Blocks you will see a setting page for includes, add the folder for the SFML includes to it. You will also see another settings page for the folders to find libraries to link to. Add the folder that SMFL has with the libraries to there.<br /><br />You will also need to tell CodeBlocks what libraries you are using so it can properly add them to the command line when calling the compiler and linker for you.

#6 kidman171   Members   


Posted 25 December 2012 - 08:29 AM


I wrote a step by step tutorial just for you, I hope it helps.

Attached Files

#7 xinfinite33   Members   


Posted 26 December 2012 - 11:35 AM

I also had alot of trouble getting SFML running the first time. what i had to do was rebuild SFML using a program called Cmake. It fixed everything and it works fine now. if you mean that you had trouble understanding how it works, and not trouble getting it running, i suggest reading the tutorials on the SFML website.

#8 IkarusDowned   Members   


Posted 27 December 2012 - 02:54 AM

Saint, its possible that you are getting a combination of problems that are escalating into a massive headache.

The problem you've posted has less to do with SFML, and more to do with understanding how C++ (and, my guess in your case since its C::B) and MinGW( aka gcc) works. 

You'll want to get some more experience with C++, maybe getting more comfortable with how linking works (both static and dynamic), along with what needs to be set in the IDE for things to compile. Also, if you're running in windows, dynamic libraries and how they work in windows is worth understanding.


This is going to be a bit of a divergence from your original post, but I think it strikes more to the heart of what you want to do:

what is your goal? Is there some reason you are attached to SFML? or even C++? 


If your goal is to get more comfortable with graphics programming, then it might be worth trying to go with C# or even Java, since its "easier" to understand. Heck, you can even use Python if you want to-- the fundamentals of graphics programming isn't going to change with the language you choose.


If you really want to use C++, then your first goal should be to get used to C++, IDEs and how C++ links / builds / executes. 

Try doing something that uses a 3rd party library and has nothing to do with graphics at all. For instance: Build, link and use one of the libraries available through Boost. 


Also, did you check this page out?


scroll down to where it says Code::Blocks. there are some tips as to what you can do to make it work.

If you are having trouble understanding what that page is talking about, then you need to step back and get more experience with C++ / C::B first.

Edited by IkarusDowned, 27 December 2012 - 02:58 AM.

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.