Category : sdl

I was following a game creation tutorial using SDL2 and encountered the following two errors: corrupted size vs. prev_size free() invalid pointer Here is the stack copied for both errors: For corrupted size vs prev_size libc.so.6!__GI_raise(int sig) (raise.c:49) libc.so.6!__GI_abort() (abort.c:79) libc.so.6!__libc_message(enum __libc_message_action action, const char * fmt) (libc_fatal.c:155) libc.so.6!malloc_printerr(const char * str) (malloc.c:5628) libc.so.6!unlink_chunk(mchunkptr p, ..

Read more

I’m using SLD2 in order to make a game, All was working perfectly since now. I think there is a problem the loading file system. for example, when i tried to load a bmp : #include <iostream> # include "SDL.h" int main(int argc, char* argv[]) { SDL_Init(SDL_INIT_VIDEO); // Initialize SDL2 SDL_Window* window = SDL_CreateWindow("game", SDL_WINDOWPOS_CENTERED, ..

Read more

Things i tried: Re-installing libpng and zlib Re-installing SDL_image-dev and all the other SDL2 Libs Re-importing the SDL_image.a lib Changed all linker options and still nothing Changed the search directories Nothing worked, still here figuring it out… Linker settings Code::Blocks -lSDL2 -lSDL2main -lSDL2_image Link Libraries: /usr/local/lib/libSDL2_image.a /usr/local/lib/libBox2D.a Search Directories: /usr/include/SDL2 Code snippet that gives me ..

Read more

I’ve been tinkering with SDL for the past few days and I’ve attempted to use remove main by using flags –nostartfiles and –entry _start on a project using SDL to reduce size. However, upon running the program, I get a segfault on any SDL command. The code works without these parameters with _start renamed to ..

Read more

#include<iostream> #include <SDL_mixer.h> #include <SDL.h> using namespace std; int main(int argc, char* argv[]) { SDL_Init(SDL_INIT_AUDIO); if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048) < 0) { cout << "Error: " << Mix_GetError() << std::endl; } Mix_Music* song = Mix_LoadMUS("sample.wav"); Mix_PlayMusic(song, 1); Mix_FreeMusic(song); song = nullptr; Mix_Quit(); SDL_Quit(); return 0; } I am trying to play a simple song, ..

Read more