Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MinGW "undefined reference to IMG_Load/IMG_Init/IMG_Quit" LazyFoo

I am going off of LazyFoo's SDL2 tutorials for C++ using the MinGW g++ compiler (using console). I have followed his page here, step-for-step. I have finally come across this error after having downloaded his example.

enter image description here

I have seen plenty of people online struggle with SDL_Image, but I've not yet seen this and I haven't found any solution to it yet.

  • I've loaded the include and lib folders with the proper assets
  • I've copied all necessary .dll's to my compile destination
  • The example LazyFoo provides includes for SDL_Image and SDL itself

(this question my sound redundant, but I've yet to come across a solution that applies to console-compilation)

like image 502
Luft Avatar asked Oct 15 '25 13:10

Luft


1 Answers

Based on the comments above, the answer seems to be:

You need to install the development libraries for SDL_image.

You can download them here: https://www.libsdl.org/projects/SDL_image/ (look under the heading "Development libraries").

You need to ensure the path where the libSDL2_image.a file resides is in the linker search path. One way of doing this is to add an appropriate -L parameter to the link command. You could also drop the file in the default library search path.

like image 173
davmac Avatar answered Oct 17 '25 01:10

davmac



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!