Hi Everyone,
I have been trying to self-teach myself how to develop a game and I am using Free Pascal and SDL2 2.0.9 to learn. I am trying to get my project to work in Ubuntu Linux 18 but it crashes with a runtime error 200 whenever I start it up. The project works just fine on Windows 10.
I've stripped the code down to just the barebone initialization of SDL2 and it still crashes in Linux. I then made the same code in C on the same Linux, and for some reason the identical C code works just fine but the Pascal version crashes.
I don't know if I am doing something wrong or if somehow maybe there is a problem with Free Pascal but I am at a loss as to how to resolve the crash. I will paste the code below. The headers I am using can be found at the following link:
https://github.com/ev1313/Pascal-SDL-2-Headers/blob/master/sdl.incI looked at the headers and I didn't see anything wrong but I am mostly a beginner so maybe the headers are not accurate or I am not using a compiler options or something? The code itself does not seem to return any errors.
Thank you to anyone who is willing to help me figure this out! This is the Pascal code (crashes) while C version doesn't:
Program testsdl;
Uses
SDL2 in 'SDL2/sdl2.pas';
Var
Window : PSDL_Window;
Renderer : PSDL_Renderer;
Begin
If SDL_Init(SDL_INIT_VIDEO) < 0 Then Begin
WriteLn ('Error init video');
Exit;
End;
Window := SDL_CreateWindow('SDL_RenderClear',
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
640, 480,
SDL_WINDOW_FULLSCREEN_DESKTOP);
If Window = NIL Then Begin
WriteLn('Error creating window');
Halt;
End;
Renderer := SDL_CreateRenderer(Window, -1, 0);
If Renderer = NIL Then Begin
WriteLn('Error creating renderer');
Halt;
End;
SDL_RenderClear(Renderer);
SDL_RenderPresent(Renderer);
SDL_Delay(5000);
SDL_Quit();
End.