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

Author Topic: Codeblocks first steps  (Read 3363 times)

0 Members and 1 Guest are viewing this topic.

Stoort

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Codeblocks first steps
« on: September 01, 2011, 08:23:51 pm »
Have installed codeblocks in c:\ and sfml-1.6 in the codeblocks folder.

When trying to create a new project the wizard appears and I select SFMLProject and give it a project name of, for example, "Test"

Next it asks me to select SFML`s location which as stated is in C:\codeblocks\SFML-1.6\

Now it tells me that the path seems valid but that it can`t locate audio.hpp . If I add \include to the path it locates it but then it can`t find the Include folder.

The only way I could get past this was to move all the include files up one folder to  ...SFML-1.6\Include

This satisfied the wizard and a new project was created.

Upon opening main.cpp however, every reference to the includes point  to a folder in SFML-1.6\Include\SFML, where to get this far I`ve just moved them all out of.

The only way to get it to run was to duplicate all include files in both \Include & \include\SFML and I know this can`t be right.

And then to cap it all off I still get an error when I build it

Cannot find -lsfml-audio.dll


I humbly beseech somebody to HELP ME PLEASE
redheadnotdeadhead

jkalmeij

  • Newbie
  • *
  • Posts: 8
    • View Profile
Codeblocks first steps
« Reply #1 on: September 01, 2011, 10:54:30 pm »
To qoute Laurent from this recent thread:
Quote
Don't use "SFML project", it's buggy. Create an empty project and follow the tutorial.

I had some troubles myself with the tutorial. You need to make sure you read everything and follow every step.
If you really can't figure it out, you could also try this tutorial here.

Joshua Flynn

  • Full Member
  • ***
  • Posts: 133
    • View Profile
Codeblocks first steps
« Reply #2 on: September 05, 2011, 02:41:24 pm »
Hi. I had wrote a tutorial on how to do this, but it was deleted, however I can crash course you on the steps involved.

Download the SFML files, and copy the SFML files into the Code::Blocks directory as directed by the installation instructions.

Create a new project, set it to console application with all the settings you prefer.

With the newly created project, on the side, right-click the named project, go to build options.

Under 'other linker options', paste this:
-lsfml-audio
-lsfml-network
-lsfml-graphics
-lsfml-window
-lsfml-system

With this done, now navigate to the project folder, enter the bin directory, then either release or debug (whichever you are presently using), and copy the SFML .dlls into it, so it should contain:

sfml-audio.dll
sfml-graphics.dll
sfml-network.dll
sfml-system.dll
sfml-window.dll

You may want to include the -d .dlls too, for completeness, but unless you explicitly modify the linker options, they won't be used.

There's an alternate with includes the required files into the executable itself proper, but I never got that way to work myself. You'll also need the gcc lib .dll too, named:

libgcc_s_dw2-1.dll

Which I will upload to a filesharing site and give to you to save you time.


Edit: To test it's working, just copy and paste the supplied clocks tutorial and see if it compiles/runs. After that, delete the code and write from scratch.

Furthermore: The above linker settings have to be in that particular order. I've already sorted them in correct order for my project.

Joshua Flynn

  • Full Member
  • ***
  • Posts: 133
    • View Profile
Codeblocks first steps
« Reply #3 on: September 05, 2011, 02:43:53 pm »

hamar

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Codeblocks first steps
« Reply #4 on: May 25, 2012, 11:55:30 am »
Hey, I know this is late, this is an old topic, but is have to tell this.

Well, I could make a working SFML poject, in codeblocks by the wizard.

All I had to do this:
1.- Download the SFML 1.6 SDK
2.- Copy [SFML directory]\include\SFML to the [SFML directory]\include directory of your Code::Blocks installation (so that you obtain include\SFML)

3.- Open C::B. Create "SFML project". Then select the SFML directory(after you did that copy in the second point you won't get any error).
4.- add in the "Project"->"Build options" -> (in the debug/release tab) "Linker settings"-> "Link libraries" the followings:
(-sfml-audio) (not necessary)
(-sfml-network) (not necessary)
-sfml-graphics
-sfml-window
-sfml-system

5.- Delete in the "Project"->"Build options" -> (program's name tab) ->"Linker settings"-> "Link libraries" all the linked things.

Now it have to work.

I hope it will be useful for someone one time. Good luck!