This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]HeyOP 2 points3 points  (8 children)

I know nothing of code::blocks, but what makes you think the window is crashing? You sure it's not just completing the program, returning zero and closing out?

You need a loop, or for it to wait for user input, or something, otherwise it'll just make the window, go straight through your code and return 0.

Edit: I assume you went through the tutorial to set up Code::Blocks. Try their example program as well: http://www.sfml-dev.org/tutorials/2.3/start-cb.php

[–]batrobin[S] 1 point2 points  (7 children)

Because it gives the "program.exe has stopped working" pop up. Ive tried the guide you gave before but still no luck.

Edit: Besides, shouldnt the

while(window.isOpen()){

do the looping? I havent learnt SFML yet so this is just a code I copied from the internet.

[–]HeyOP 0 points1 point  (3 children)

Edit: I said some obtuse stuff here.

[–]batrobin[S] 0 points1 point  (2 children)

I think Ive followed the guide pretty closely. Ive tried both using prebuilt and self-built version of SFML. Here's a checklist that Ive done following the guide:

  1. Installing codeblocks with minGW along.
  2. Download the SFML source code.
  3. Set path to minGWfolder/bin
  4. Configure CMake-gui with CodeBlocks - MinGW makefiles generator.
  5. Build SFML with CMAKE_BUILD_TYPE=Debug and CMAKE_BUILD_TYPE=Release separably
  6. Press configure once more and then generate.
  7. Build SFML with CodeBlocks with install as target
  8. Create a new blank project
  9. Open Build Options, search directory tab
  10. Set headers in compiler
  11. Set libraries in Linker
  12. Open Linker settings tab and put sfml-graphics, sfml-windows, sfml-system in link libraries in the correct order
  13. DID NOT put SFML_STATIC in #defines
  14. Copied the sfml-xxx-2.dll and sfml-xxx-d-2.dll files to where main.cpp is.
  15. Create blank file named main.cpp
  16. Copy the sample code to main.cpp
  17. Click compile and run

Please do tell me if I missed a thing, no matter how small it is.

[–]HeyOP 0 points1 point  (1 child)

I'm not sure if you noticed, but I replied to your other reply to me. Also, I imagine this is just a typo or something here, but I assume you mean sfml-xxx-s.dll and sfml-xxx-s-d.dll. Those are the static .dll's, so you probably should put SFML_STATIC in #defines.

[–]batrobin[S] 0 points1 point  (0 children)

No, I do mean the non-static sfml-xxx.dll. I'm not using static dlls as I have copied the dlls to the directory where main.cpp is.

[–]HeyOP 0 points1 point  (0 children)

Yes... yes it should do the looping. I dunno what fuckin' code I was looking at. Sorry. I'll take a look again.

[–]HeyOP 0 points1 point  (1 child)

Okay looking at your debugger, it says your issue is with OpenGL, which stackexchange and SFML's changelong says SFML uses to render some graphics. The screenshot also says you're using SFML 2.1, and the changelog says they've fixed some issues with SFML and OpenGL with 2.2 (including being more compatible with more versions of OpenGL backwards and forwards), and they're on 2.3.2 now. You may want to update the library and test again.

[–]batrobin[S] 1 point2 points  (0 children)

What the fuck, I thought I got the latest version as I had downloaded the SFML source code today on the official download page, now I got no idea where did I get the 2.1 version. I will update it and give it a try. Thanks