Hi, I installed SDL2 and and I’m trying to use it in my C++ program, but I can’t find it anywhere on the system! Where is SDL2 installed to? If it’s not under /usr/include, then where is it installed to? Where are the header files?
Thanks
Hi, I installed SDL2 and and I’m trying to use it in my C++ program, but I can’t find it anywhere on the system! Where is SDL2 installed to? If it’s not under /usr/include, then where is it installed to? Where are the header files?
Thanks
Hi
You should try and use pkg-config to use the pc file…
pkg-config --help
pkg-config --cflags SDL2
Else if you look down in for example /usr/lib64/pkgconfig/ you should see sdl2.pc. Inspect the file and you will find it’s
Cflags: -I${includedir}/SDL2 -D_REENTRANT
Why can’t you just put the header files in /usr/include? It’s more practical that way.
Hi
Then what happens if you have headers for two different releases (eg SDL and SDL2)… many headers are like that, hence using pkg-config in your makefile would take care of that across any distribution.
You put the headers into two different folders. No offence but the average developer isn’t gonna know any of this, and it’s a real let-down on openSUSE’s platform for development. I can see that you’re trying to avoid version-conflicts, but you don’t solve it by shelving all the header files and such. Developers aren’t stupid, they know which version of which library they wanna go for. What’s more ironic is that these instructions are also stupid; that command you gave me doesn’t even work coz it can’t find SDL2 even though SDL2 is installed.
and do not need to read documentation, as it looks like.
Once you have the library installed, you can use the sdl2-config program to help you compile your own code:
- gcc -o myprogram myprogram.c
sdl2-config --cflags --libs
On Sun, 31 Jul 2016 07:56:01 +0000, 531n wrote:
> What’s more ironic is that these instructions are also stupid; that
> command you gave me doesn’t even work coz it can’t find SDL2 even though
> SDL2 is installed.
Perhaps you didn’t install the -devel packages.
Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C
On Sun, 31 Jul 2016 07:56:01 +0000, 531n wrote:
> What’s more ironic is that these
> instructions are also stupid; that command you gave me doesn’t even work
> coz it can’t find SDL2 even though SDL2 is installed.
Perhaps you didn’t install the -devel packages. You didn’t say what
you’ve installed, so it’s kinda hard to guess what the problem is without
more specific information.
Rather than using words like “stupid”, when asking for help, it’s
generally useful not to use negative language when responding to the
people trying to help you. Malcolm doesn’t package that code, he’s
trying to help you.
Getting angry with him doesn’t help you at all.
Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C
The problem with this approach however is that it’s not uniform; Ubuntu doesn’t force you to link libraries like this, nor does Arch Linux, nor does Debian. openSUSE, however, for some contrarian reason prefers using some program and add unnecessary complexity to an otherwise straightforward process. In Ubuntu, if I wanted to link a library I would just use libSDL2.so for version 2 of SDL; libSDL for version 1. There I can see what version I’m working with. But one isn’t gonna understand what SDL-devel or sdl2-config means.
Which is exactly the same in openSUSE.
On Tue, 16 Aug 2016 19:16:01 +0000, 531n wrote:
> But one isn’t gonna understand what SDL-devel or sdl2-config means.
Arguably, there are plenty of developers who do understand that.
I switch back and forth between several different distros for work, and
whenever I’m building stuff, the first thing I do is look for -dev or -
devel packages to add to the environment.
That has generally not failed me yet when it comes to RPM-based distros.
It’s important for you to remember that this forum is essentially “users
helping users” - so again, getting pissed at those of us here trying to
help you isn’t going to get you help. Complaining about why things are
the way they are isn’t going to help - and a change this big isn’t likely
to happen because of the disruption to everyone who has taken the time to
learn how it’s done.
Your best course of action is to learn how it’s done in openSUSE. It
really isn’t all that different from other distributions.
Jim
–
Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C
On Tue, 16 Aug 2016 19:16:01 +0000, 531n wrote:
> In Ubuntu, if I wanted to link a library I would just use libSDL2.so
> for version 2 of SDL; libSDL for version 1.
> There I can see what version I’m working with.
And I’d confirm that that is exactly what you do in openSUSE. You just
need to install the development packages first to have the headers and
other stuff required for development.
Not everyone develops or compiles code in their installation - so
development packages are optional.
Jim
–
Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C
Ok, suppose that I’ve installed SDL-devel and I get this file called SDL-devel. What do I do that with that file? How do I get the shared objects like libSDL.so from that file?
On Fri, 16 Sep 2016 14:26:01 +0000, 531n wrote:
> Ok, suppose that I’ve installed SDL-devel and I get this file called
> SDL-devel. What do I do that with that file? How do I get the shared
> objects like libSDL.so from that file?
You install it like any other RPM package.
The package you want is libSDL-devel. Try running:
sudo zypper in libSDL-devel
And see what it does. You can see the contents of the installed package
using the command:
rpm -ql libSDL-devel
Jim
–
Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C
Thanks, now I understand. i might have installed something else.