• Advertisement
Sign in to follow this  

SDL 2.0 setup un Ubuntu

This topic is 1505 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement

With your initial description, we can't possibly do better than a generic article on the web. You need to give us a lot of detail about what you have tried, what error messages you got, etc.

 

And then again, this might not be the best forum to post your question: Both Ubuntu and SDL have forums where you can probably find people who know much more about this. Anyway, if you go through the trouble of giving us a chance at knowing what the problem is, I'll help you. But I can't get you very far with a description like "./configure command don't work to me".

Edited by Álvaro

Share this post


Link to post
Share on other sites

I'm sorry about disturbing your time, I already have  solution. I used Synaptic pachage manager to install SDL2 packages and compiled g++ with parameters -lSDL2 -L /path/to/libs -I /path/includes ;)

Edited by kaktusas2598

Share this post


Link to post
Share on other sites

Umm, no need for those things. AFAIK, most libraries in UNIX world either use pkg-config or custom libraryName-config programs to provide processor/linker flags. In the case of SDL2, I think the custom program is sdl2-config - i.e. running something like:

[source=bash]g++ file.cpp `sdl2-config --cflags --libs`[/source]

should be the preferred method on unix/linux machines, as it is portable. A more generic approach would be to use pkg-config:

[source=bash]g++ file.cpp `pkg-config --cflags --libs sdl2`[/source]

 

However, I would strongly recommend against compiling on the command line. It is a waste of time and productivity. Both Eclipse and QtCreator are great IDEs for C++, and you should use one if you want to focus on getting stuff done and not on compiling. If you are *really* intent on learning how to compile on linux, at least look up make files and normal build systems like cmake and scons.

 

A few tips on linux distributions: although library imports are generally named libNAME.a, you include them via their name only (-l NAME) - unlike Visual Studio. All libraries installed via the package manager (in your case, apt) go to /usr/include (in case you want to browse them manually). Usually you can execute shell commands and include the output of those commands in another command. That is why I've put accents (`) and not quotes (') around sdl2-config and pkg-config. Those programs print to stdout, but with the accents syntax you capture the output and put in in your command string. You can view documentation on C functions via the man command, e.g. man 3 printf would show you the documentation for printf. Some packages install man pages as well, but most don't. I haven't found the manual pages particularly useful for c++, though.

 

[Note: I don't have an ubuntu box atm and I haven't spell-checked the commands]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement