SFML community forums

Help => General => Topic started by: R3B3LCAUSE on December 04, 2013, 10:07:07 pm

Title: "SFML works!" tutorial not working
Post by: R3B3LCAUSE 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 (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.
Title: Re: "SFML works!" tutorial not working
Post by: eXpl0it3r 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). :)
Title: Re: "SFML works!" tutorial not working
Post by: R3B3LCAUSE on December 04, 2013, 10:16:07 pm
Just double checked that, debug has the -d
Title: Re: "SFML works!" tutorial not working
Post by: R3B3LCAUSE on December 05, 2013, 02:55:26 am
Bump. Please help
Title: AW: "SFML works!" tutorial not working
Post by: eXpl0it3r on December 05, 2013, 05:44:30 am
What SFML package did you download? And what's your compiler?
Title: Re: "SFML works!" tutorial not working
Post by: R3B3LCAUSE 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
Title: Re: "SFML works!" tutorial not working
Post by: eXpl0it3r on December 07, 2013, 09:22:42 pm
I guess you then need to provide more information, e.g. see here (http://en.sfml-dev.org/forums/index.php?topic=12552.0).
Title: Re: "SFML works!" tutorial not working
Post by: R3B3LCAUSE 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?
Title: Re: "SFML works!" tutorial not working
Post by: eXpl0it3r 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.
Title: Re: "SFML works!" tutorial not working
Post by: Grimshaw on December 08, 2013, 07:57:15 pm
The build troubleshooting Jedi strikes again! woosh!
Title: Re: "SFML works!" tutorial not working
Post by: R3B3LCAUSE 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
Title: AW: "SFML works!" tutorial not working
Post by: eXpl0it3r 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. ;)
Title: Re: "SFML works!" tutorial not working
Post by: R3B3LCAUSE on December 08, 2013, 10:42:43 pm
Oh that's it! Thanks
Title: Re: "SFML works!" tutorial not working
Post by: R3B3LCAUSE 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
Title: AW: "SFML works!" tutorial not working
Post by: eXpl0it3r on December 09, 2013, 06:51:08 am
Post the new build command and error.
Title: Re: "SFML works!" tutorial not working
Post by: R3B3LCAUSE on December 11, 2013, 04:58:49 am
Sorry it took so long, I've been busy.

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

Cleaned "Test - Debug"

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

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

What error are you referring to? The program doesn't open at all, there is no error message. Trying to run it from CodeBlocks gives this
Quote
Process terminated with status -1073741819 (0 minutes, 19 seconds)
and the debugger still shows the same "segmentation fault"
Title: Re: "SFML works!" tutorial not working
Post by: R3B3LCAUSE on December 14, 2013, 06:45:51 pm
Bump. Still need help
Title: AW: "SFML works!" tutorial not working
Post by: eXpl0it3r on December 14, 2013, 07:03:49 pm
It's not clear. Does the process ever start (check with task manager)?
What if you run it through the debugger?

Have you made a clean rebuild?
Title: Re: "SFML works!" tutorial not working
Post by: R3B3LCAUSE on December 14, 2013, 07:19:17 pm
It does show up in task manager, but it dies quickly.
Ive run it through the debugger, as I said, and it reports a "segmentation fault"

I have rebuilt it several times, every time i make a change
Title: AW: "SFML works!" tutorial not working
Post by: eXpl0it3r on December 14, 2013, 07:37:51 pm
Where exactly does it show that error code?

When run through the debugger it should jump to the part where the error originates from?
Title: Re: AW: "SFML works!" tutorial not working
Post by: R3B3LCAUSE on December 14, 2013, 09:12:56 pm
Where exactly does it show that error code?

When run through the debugger it should jump to the part where the error originates from?

I'm sorry, I'm not sure what you mean by "error code"; there is no error message that pops up, the CodeBlocks build log shows the "Process terminated with status -1073741819 (0 minutes, 19 seconds)", and the debugger says that there is a "Segmentation Fault" but I'm not sure what that means.
Title: Re: "SFML works!" tutorial not working
Post by: wintertime on December 15, 2013, 12:11:33 am
That means a fault got triggered inside the CPU, because the program was accessing unaccessible/nonexistent/unallocated memory.
You could look if the debugger shows a source line where it happens or single step the program to find it.