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

Author Topic: "SFML works!" tutorial not working  (Read 7247 times)

0 Members and 2 Guests are viewing this topic.

R3B3LCAUSE

  • Newbie
  • *
  • Posts: 12
    • View Profile
"SFML works!" tutorial not working
« on: December 04, 2013, 10:07:07 pm »
NOOB DISCLAIMER: I apologize if I missed something obvious or left important info out of my description, I am new to all of this.

I am trying to use SFML with CodeBlocks. I followed all the instructions on the SFML tutorial: http://www.sfml-dev.org/tutorials/2.1/start-cb.php and then copy and pasted the example code. It compiled with no errors or warnings, but it won't execute. The debugger says that

Quote
"Program received signal SIGSEGV, Segmentation fault.
In sf::String::String () (C:\[directory]\bin\Release\sfml-system-2.dll)"

I am not sure what that means or how to fix it.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: "SFML works!" tutorial not working
« Reply #1 on: December 04, 2013, 10:13:45 pm »
If you're running in debug mode, make sure you link against the debug libraries, that is the ones with the -d suffix (e.g. sfml-system-d). :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

R3B3LCAUSE

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: "SFML works!" tutorial not working
« Reply #2 on: December 04, 2013, 10:16:07 pm »
Just double checked that, debug has the -d

R3B3LCAUSE

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: "SFML works!" tutorial not working
« Reply #3 on: December 05, 2013, 02:55:26 am »
Bump. Please help

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: "SFML works!" tutorial not working
« Reply #4 on: December 05, 2013, 05:44:30 am »
What SFML package did you download? And what's your compiler?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

R3B3LCAUSE

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: "SFML works!" tutorial not working
« Reply #5 on: December 07, 2013, 05:43:48 pm »
My package is SFML-2.1-windows-gcc-4.7-tdm-32bits.zip and my compiler is the default GCC sjlj compiler that comes with CodeBlocks

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: "SFML works!" tutorial not working
« Reply #6 on: December 07, 2013, 09:22:42 pm »
I guess you then need to provide more information, e.g. see here.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

R3B3LCAUSE

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: "SFML works!" tutorial not working
« Reply #7 on: December 08, 2013, 06:36:33 pm »
Quote
-------------- Clean: Debug in Test ---------------

Cleaned "Test - Debug"

-------------- Build: Debug in Test ---------------

mingw32-g++.exe -Wextra -Wall  -g    -I"C:\Users\[edit]\SFML-2.1\include" -I"C:\Users\[edit]\SFML-2.1\include"  -c "C:\Program Files (x86)\CodeBlocks\Projects\Test\Main.cpp" -o obj\Debug\Main.o
mingw32-g++.exe -L"C:\Users\[edit]\SFML-2.1\lib"  -o "bin\Debug\Test.exe" obj\Debug\Main.o    -lsfml-graphics -lsfml-window -lsfml-system -lsfml-graphics-d -lsfml-window-d -lsfml-system-d  -mwindows
Output size is 748.37 KB
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 0 warnings
 

Is there anything wrong here?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: "SFML works!" tutorial not working
« Reply #8 on: December 08, 2013, 07:08:37 pm »
And we're back to my first statement:
If you're running in debug mode, make sure you link against the debug libraries, that is the ones with the -d suffix (e.g. sfml-system-d). :)

You're linking against the release libraries (without -d suffix) instead of the debug libraries in debug mode.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Re: "SFML works!" tutorial not working
« Reply #9 on: December 08, 2013, 07:57:15 pm »
The build troubleshooting Jedi strikes again! woosh!

R3B3LCAUSE

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: "SFML works!" tutorial not working
« Reply #10 on: December 08, 2013, 09:29:51 pm »
And we're back to my first statement:
If you're running in debug mode, make sure you link against the debug libraries, that is the ones with the -d suffix (e.g. sfml-system-d). :)

You're linking against the release libraries (without -d suffix) instead of the debug libraries in debug mode.

Quote
-------------- Clean: Debug in Test ---------------

Cleaned "Test - Debug"

-------------- Build: Debug in Test ---------------

mingw32-g++.exe -Wextra -Wall  -g    -I"C:\Users\[edit]\SFML-2.1\include" -I"C:\Users\[edit]\SFML-2.1\include"  -c "C:\Program Files (x86)\CodeBlocks\Projects\Test\Main.cpp" -o obj\Debug\Main.o
mingw32-g++.exe -L"C:\Users\[edit]\SFML-2.1\lib"  -o "bin\Debug\Test.exe" obj\Debug\Main.o    -lsfml-graphics -lsfml-window -lsfml-system -lsfml-graphics-d -lsfml-window-d -lsfml-system-d  -mwindows
Output size is 748.37 KB
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 0 warnings
 

Is there anything wrong here?

I can see the -d

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: "SFML works!" tutorial not working
« Reply #11 on: December 08, 2013, 09:58:38 pm »
I can see them too, but in the same statement you're also linking against the release libraries and since you link against them first, they'll get used first.

My guess is, that you set the release libraries in the global settings instead of just the release settings. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

R3B3LCAUSE

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: "SFML works!" tutorial not working
« Reply #12 on: December 08, 2013, 10:42:43 pm »
Oh that's it! Thanks

R3B3LCAUSE

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: "SFML works!" tutorial not working
« Reply #13 on: December 09, 2013, 01:26:05 am »
Crap, it didn't work. I removed the global linking settings and recompiled it but it still wont execute

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: "SFML works!" tutorial not working
« Reply #14 on: December 09, 2013, 06:51:08 am »
Post the new build command and error.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything