SDL2

Post here any ideas/problems/suggestions you have regarding CodeLite's ExternalTools plugin
greertr
CodeLite Curious
Posts: 6
Joined: Thu May 24, 2018 3:51 pm
Genuine User: Yes
IDE Question: C++
Contact:

SDL2

Post by greertr » Fri May 25, 2018 11:02 pm

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.

User avatar
eranif
CodeLite Plugin
Posts: 5887
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: SDL2

Post by eranif » Sat May 26, 2018 7:57 pm

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
Make sure you have read the HOW TO POST thread

greertr
CodeLite Curious
Posts: 6
Joined: Thu May 24, 2018 3:51 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: SDL2

Post by greertr » Sat May 26, 2018 8:56 pm

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!

User avatar
eranif
CodeLite Plugin
Posts: 5887
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: SDL2

Post by eranif » Sun May 27, 2018 11:57 pm

Just the name
e.g. "SDL2"

The "-l" will be added by CodeLite
Make sure you have read the HOW TO POST thread

greertr
CodeLite Curious
Posts: 6
Joined: Thu May 24, 2018 3:51 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: SDL2

Post by greertr » Mon May 28, 2018 3:58 am

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.
You do not have the required permissions to view the files attached to this post.

Post Reply