Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Setting up on Codeblocks  (Read 1387 times)

0 Members and 1 Guest are viewing this topic.

TheScripterGeek

  • Newbie
  • *
  • Posts: 1
    • View Profile
Setting up on Codeblocks
« on: December 15, 2016, 10:48:06 pm »
Hi, I would like to use SFML 2.4 on code blocks 16.01, the tutorial didn't help at all.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 9240
    • View Profile
    • development blog
    • Email
Re: Setting up on Codeblocks
« Reply #1 on: December 16, 2016, 10:28:57 am »
Hi,

Without any proper problem description, we unfortunately can't help you either. ;)
See the forum rules.
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

jamesL

  • Full Member
  • ***
  • Posts: 120
    • View Profile
Re: Setting up on Codeblocks
« Reply #2 on: December 16, 2016, 06:58:16 pm »
go here
http://www.codeblocks.org/downloads/binaries

download this
codeblocks-16.01mingw-nosetup.zip

put it in a folder
C:\New_folder\codeblocks-16.01mingw-nosetup.zip

unzip it
C:\New_folder\codeblocks-16.01mingw-nosetup

go here
http://www.sfml-dev.org/download/sfml/2.4.1/

download this
GCC 4.9.2 TDM (SJLJ) - 32-bit

put it in a folder
C:\New_folder\SFML-2.4.1-windows-gcc-4.9.2-tdm-32-bit.zip

unzip it
C:\New_folder\SFML-2.4.1-windows-gcc-4.9.2-tdm-32-bit

go to your codeblocks folder
C:\New_folder\codeblocks-16.01mingw-nosetup

run
CbLauncher.exe

it will ask you which compiler you want to use
it will tell you it has detected
GNU GCC Compiler

select and highlight that compiler and click the
Set as Default
button

then click
OK

now it may ask you if you want to set codeblocks as the default application for C and C++ files
choose any option you want - it does not matter
if it doesn't ask, that's ok

click the OK button

click the
Create a new project
option

a window will pop up with Project templates

scroll down and find
SFML project

select it and press Go

it will say
"Welcome to the SFML project wizard"

Click Next >

it will give you a choice for SFML 1.6 and SFML 2.0

make sure 2.0 is highlighted
press Next >

It will ask you which type of library to add

Choose Dynamic Link Library
press Next >

Project title = project_1
Folder to create project in = C:\New_folder\
press Next >

A window pops up asking you to select the location of SFML on your computer
it says
$(#sfml)
change it to
C:\New_folder\SFML-2.4.1-windows-gcc-4.9.2-tdm-32-bit\SFML-2.4.1

press Next >

a window pops up asking you about Debug and Release
leave as is
press Finish

A project and C++ file have been created for you

go to the codeblocks menu and press
Build
then
Build

Your program should build with no errors
you will not be able to run your program yet.

first go to
C:\New_folder\SFML-2.4.1-windows-gcc-4.9.2-tdm-32-bit\SFML-2.4.1\bin
copy all the files in ^ this folder

and paste them here (this is a copy, not a move)
C:\New_folder\project_1\bin\Debug

go to the codeblocks menu and press
Build
then
Run

this builds a 32 bit executable

going into the Project / Build options and selecting
c++11
or
c++14
will make no difference

this should be enough to get you started

however, you will eventually run into problems with this 

as far as I can tell this version of the compiler leaves out some C++ functions that you might find in some SFML examples

specifically the
to_string
function 

it was broken in MinGW and eventually fioxed in MinGW-w64
as detailed here
http://stackoverflow.com/questions/12975341/to-string-is-not-a-member-of-std-says-g

you can eventually install a correct compiler and corresponding SFML version from the SFML download page

but this should be enough to get you started

oh, if you add
C:\New_folder\SFML-2.4.1-windows-gcc-4.9.2-tdm-32-bit\SFML-2.4.1\bin
to your PATH
or copy the dlls to a folder already in your PATH then you won't have to copy them all the time

 

anything