Given:
- 32-bit Windows XP
- 32-bit MinGW with gcc
- 32-bit dev-versions of SDL2, SDL2_image and SDL2_ttf, unpacked in
C:\MinGW\libandC:\MinGW\include(I know that this is ugly, but I’m disdainful of Windows and me at least somehow :) (i686-blabladirectories pulled from here: SDL , SDL_image , SDL_ttf ) - A simple program that successfully builds and works under Linux without any kicks.
Problem: does not link. By the method of googling, copy-paste and scientific spear I assembled such a team, issuing a minimum of errors:
mingw32-gcc -Wall -Dmain=SDL_main -lmingw32 -lSDL2main -lSDL2 -lSDL2_image -lSDL2_ttf src\*.c -o myprog.exe
This I have somehow solved the problems with non-found inclusions and duplicated main (my main is registered as int main(int argc, char *argv[]) according to Google's advice). However, when trying to collect all the errors it has:
Temp\ccOZXxwh.o:amtile.c:(.text+0x6ee): undefined reference to `SDL_Init' Temp\ccOZXxwh.o:amtile.c:(.text+0x734): undefined reference to `SDL_CreateWindow' Temp\ccOZXxwh.o:amtile.c:(.text+0x759): undefined reference to `SDL_GetWindowSurface' Temp\ccOZXxwh.o:amtile.c:(.text+0x770): undefined reference to `IMG_Init' Temp\ccOZXxwh.o:amtile.c:(.text+0x810): undefined reference to `TTF_Init' Temp\ccOZXxwh.o:amtile.c:(.text+0x830): undefined reference to `TTF_OpenFont' Well, and so on. I tried to prescribe -LC:\MinGW\lib , check for the presence of the corresponding *.a files there - everything is there, but not going.
What am I doing wrong and how to do it right?
#include <SDL2/SDL.h>\n int main(int, char**){SDL_Init(SDL_INIT_VIDEO);}is#include <SDL2/SDL.h>\n int main(int, char**){SDL_Init(SDL_INIT_VIDEO);}normally withg++ main.cpp -lmingw32 -lSDL2main -lSDL2 -o main.exe( win10x64, msys64) - Vladimir Gamalyan