So, I have a command I run to compile this experiment. It looks like this.
"F:\Software-Development\mingw32\bin\gcc.exe" "F:\Software-Development\Sources\experiment\source\main.c" -L "F:\Software-Development\Sources\experiment\objects\" -Wall -o "F:\Software-Development\Sources\experiment\~build\EXP" -lSDL2
main.c is just a slightly modified tutorial from Lazyfoo so that it SHOULD work in pure C, though I can't actually test it. If the actual source code is required for whatever reason, I do have a testing package I assembled here. It probably won't work, but again, can't test it for errors. Please do not inform me of potential errors in my code, unless it's actually relevant to this error.
\objects\ is where my .a files are stored. For some inexplicable reason, however, whenever I execute this command, it throws an error. Not a cannot find -lSDL2: No such file or directory
error, but rather an undefined reference to `SDL_X'
error.
This makes no sense to me, the .a files are right there, and I'm not sure what is going on. My only clue in is that removing -L throws the cannot find -lSDL2
error, while modifying what's in the -L parameter changes literally nothing. I've asked elsewhere for help, I've looked around at problems, and it seems that I have left but to ask Stack Overflow for something that's probably really trivial.
So I've discovered the reason why. This is absolutely ridiculous, but mingw's GCC compilation does not appear to account for -L
correctly. The only solution you can do to rectify this error is to remove the -L
dir flag and putting the .a
files into the mingX\lib
folder.