Page 1 of 1

SDL2

Posted: Fri May 25, 2018 11:02 pm
by greertr
I'm needing to add SDL2 to Code-Lite so that I can finish up a C++ course I'm taking online.

Is there any instruction on how to go about adding external libraries to Code-Lite?

Any help on this is appreciated.

I've already placed the dll file in my mingw bin folder and the include and lib folder contents are copied into the mingw structure, but I'm not sure about setting environment variables for the compiler using code-lite.

Re: SDL2

Posted: Sat May 26, 2018 7:57 pm
by eranif
You should not mix your own DLLs (i.e. SDL ) with the installation of MinGW.

You should edit the project settings for this:
Right click on the project icon and select 'Settings->Compiler->Include paths' and set there the path to the .h files
Right click on the project icon and select 'Settings->Linker->Libraries Search Paths' and set there the path to the .dll/.a files
Right click on the project icon and select 'Settings->Linker->Libraries' and set there the *name* of the .dll/.a files

Re: SDL2

Posted: Sat May 26, 2018 8:56 pm
by greertr
thanks a lot, Eran...i had been looking for settings on the top main menu.

By "names" for the libraries, do you mean this? ... -lmingw64;-lSDL2main;-lSDL2

[edit/update]
SDL2main; SDL2 seems to work - just have one error left, an undefined reference to winmain - maybe because i'm running the example on a console project?

again, thx!

Re: SDL2

Posted: Sun May 27, 2018 11:57 pm
by eranif
Just the name
e.g. "SDL2"

The "-l" will be added by CodeLite

Re: SDL2

Posted: Mon May 28, 2018 3:58 am
by greertr
Thx -- I did finally get SDL2 working. IIn additon to following your guidance to the letter, I had to add and include for windows.h and change the int main as indicated by the attached image. Doing it this way worked with no further erros.