SFML community forums
Help => General => Topic started 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
"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.
-
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). :)
-
Just double checked that, debug has the -d
-
Bump. Please help
-
What SFML package did you download? And what's your compiler?
-
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
-
I guess you then need to provide more information, e.g. see here (http://en.sfml-dev.org/forums/index.php?topic=12552.0).
-
-------------- 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?
-
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.
-
The build troubleshooting Jedi strikes again! woosh!
-
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.
-------------- 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
-
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. ;)
-
Oh that's it! Thanks
-
Crap, it didn't work. I removed the global linking settings and recompiled it but it still wont execute
-
Post the new build command and error.
-
Sorry it took so long, I've been busy.
-------------- 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 Process terminated with status -1073741819 (0 minutes, 19 seconds)
and the debugger still shows the same "segmentation fault"
-
Bump. Still need help
-
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?
-
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
-
Where exactly does it show that error code?
When run through the debugger it should jump to the part where the error originates from?
-
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.
-
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.