Whenever I try and compile with mingw32-make -f .\MakeFile
it outputs this error:
g++ -Iinclude -Iinclude/sdl -Iinclude/headers -Llib -o test src/*.cpp -lmingw32 -lSDL2main -lSDL2 -lSDL2_image
C:\Users\spr\AppData\Local\Temp\ccpQRKDb.o:main.cpp:(.text+0xf): undefined reference to `SDL_Init'
C:\Users\spr\AppData\Local\Temp\ccpQRKDb.o:main.cpp:(.text+0x33): undefined reference to `SDL_GetError'
C:/Program Files (x86)/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/../lib/gcc/i686-w64-mingw32/8.1.0/../../../../i686-w64-mingw32/lib/../lib/libmingw32.a(lib32_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x39): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [.\MakeFile:2: all] Error 1
Here is the code:
#include <SDL.h>
#include <SDL_image.h>
#include <iostream>
int main(int argc, char* argv[])
{
if(SDL_Init(SDL_INIT_VIDEO) > 0)
{
std::cout << "SDL_INIT FAILED. SDL_ERROR: " << SDL_GetError() << std::endl;
return 1;
}
return 0;
}
I followed this tutorial on how to set up SLD2 with VScode on Windows: https://www.youtube.com/watch?v=9Ca-RVPwnBE