0

So I am trying to make game in C using SDL2 (both i686-w64... and x86...)

This is code I have:

#include "include/SDL2/SDL.h"
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char* argv[])
{
    if (SDL_Init(SDL_INIT_EVERYTHING) != 0) return -1;
}

and error:

PS C:\Users\Olex7\OneDrive\Pulpit\Game> make 
gcc -c -g src/main.c -o src/main.o
gcc src/main.o -g -o build/game
src/main.o: In function `SDL_main':
C:\Users\Olex7\OneDrive\Pulpit\Game/src/main.c:7: undefined reference to `SDL_Init'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:7: build/game] Error 1
  • Where are your `-l` flags? They should be mentioned in the tutorial you're following. Or here: [How do I use SDL2 in my programs correctly?](https://stackoverflow.com/a/64396980/2752075) – HolyBlackCat Dec 01 '22 at 20:21
  • Also a reminder that GCC 6.x is outdated. You can get 12.x from [MSYS2](https://stackoverflow.com/q/30069830/2752075). – HolyBlackCat Dec 01 '22 at 20:22

0 Answers0