Jump to content

  • Log In with Google      Sign In   
  • Create Account


SDL2 question


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Aliii   Members   -  Reputation: 1445

Like
0Likes
Like

Posted 20 April 2014 - 01:21 PM

I want to use SDL2 under Linux and Win within a C++ project. Can I just add the source code to my project and expect it to work? Are there some special dependencies? Thanks!

 

edit: this is the first time Im trying SDL.


Edited by Aliii, 20 April 2014 - 01:22 PM.


Sponsor:

#2 fluffybeast   Members   -  Reputation: 132

Like
1Likes
Like

Posted 20 April 2014 - 03:58 PM

You need to install it first.What version of Linux are you using?

I'm not sure how to do it on every platform, but I know you can install it via your package manager on Fedora and Arch. On Ubuntu or Miny you can follow this guide.



#3 rip-off   Moderators   -  Reputation: 8120

Like
2Likes
Like

Posted 20 April 2014 - 04:08 PM

That would probably work, but it may introduce unwanted licensing issues - though SDL has a liberal license IIRC.

On Linux, if you're happy with the version of SDL that can be installed via the package manager, then that is the simplest route. If not, you can download or checkout the appropriate version and build / install it manually. Once installed, you'll need to configure your building toolchain to include the appropriate arguments. As a simple example, from the command line something like the following:
$ g++ main.cpp -o sdl-test `sdl-config --cflags --libs`
You can manually invoke the sdl-config to see what arguments it is passing to the compiler / linker. Generally, you don't actually build directly on the command line but instead using some kind of Make like tool and/or an IDE. You'll need to figure out how to ensure the relevant command line arguments are passed to the compiler / linker on a per-tool basis.

On Windows, if you use Visual Studio typically one downloads a precompiled version of the library. You may need to configure your project with the correct additional include / library directories, and the static libraries you want to link to. You'll also want to copy the SDL DLL into your project directory. If you are using the same toolchain as on Linux, then the process tends to be quite similar - just without the package manager.

Basic SDL should be standalone, you won't need other dependencies. If you want to use any of the add-on libraries, such as SDL_TTF, SDL_Image or SDL_Net, you may need to install their dependencies. This is a similar process, but simpler as you may not need the headers and static libraries, just the DLLs / shared objects.

Please read the SDL FAQ for more information on specific toolchains.

#4 Aliii   Members   -  Reputation: 1445

Like
0Likes
Like

Posted 20 April 2014 - 07:40 PM

Thanks! Ive installed it on Linux, included the libs/header and it works fine. I guess I wont need to compile it myself.

 

 

You need to install it first.What version of Linux are you using?

 

Kubuntu. Ive found it through the package manager(libsdl2 and libsdl2-dev).



#5 fluffybeast   Members   -  Reputation: 132

Like
0Likes
Like

Posted 21 April 2014 - 02:08 AM

Thanks! Ive installed it on Linux, included the libs/header and it works fine. I guess I wont need to compile it myself.

 

 

You need to install it first.What version of Linux are you using?

 

Kubuntu. Ive found it through the package manager(libsdl2 and libsdl2-dev).

That's great! I'm glad they decided to add SDL2, much easier than having to compile it yoursefl.
 






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS