Hello, i have recently decided to start learning some c++ as with previous languages, i feel its easier to understand "how things work" by creating small games or animations.
I have come across this tutorial on SDL here:
And here is the code i have put together after following that:
(for the sake of syntax highlighting
And compiled with:
g++ main.cpp -o main `sdl-config --libs --cflags`
Now for the issue, i can't seem to fix this error:
SDL Drawing Test!
zsh: segmentation fault ./main
When i run it under gdb, the output shows:
% gdb main
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
Reading symbols from /home/ricky/Devel/cpp-sdl/main...(no debugging symbols found)...done.
Starting program: /home/ricky/Devel/cpp-sdl/main
[Thread debugging using libthread_db enabled]
SDL drawing test started!
[New Thread 0x7fffee678700 (LWP 23754)]
[Thread 0x7fffee678700 (LWP 23754) exited]
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b719f8 in SDL_Flip () from /usr/lib/libSDL-1.2.so.0
The only place i have SDL_Flip() mentioned is inside DrawScene(), i tried commenting out that line, obviously the application only then shows a black screen.
Any help explaining why this is segfaulting would be awesome, thanks.