I was creating images in C, and I wanted to render the .ppm images on SDL2, and I made the installation, following the steps here, but I encounter problems linking just a simple test for a window, the linker cannot found the implementation, even tho the SDL2.dll is in the same directory that my .c file
I am not using a Cmake file to compile the code I'm using some commands recommended here to compile
gcc testSDL.c -o jaja.exe -lmingw32 -lSDL2 -l"C:\MinGW\lib"
gcc testSDL.c -o jaja.exe -lmingw32 -lSDL2 -lC:\C_libraries\SDL2\x86_64-w64-mingw32\lib
The code is just
#include <stdio.h>
#include <SDL2/SDL.h>
int main(int argc, char *argv[])
{
if (SDL_Init(SDL_INIT_EVERYTHING) != 0) {
printf("error initializing SDL: %s\n", SDL_GetError());
}
SDL_Window* win = SDL_CreateWindow("GAME",
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
1000, 1000, 0);
while (1);
return 0;
}
I tried almost everything I could (even incluiding manually into the comand the path to the include files), and I'm also using some VS Code extension to compile (like Code runner), also I'm using the x64SDL library, And I'm using the MinGW to run things.
But I still get this errors:
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lC:\MinGW\lib
collect2.exe: error: ld returned 1 exit status