I have installed "libsdl1.2-dev" and "libvlc" (with sudo apt-get install blah) in Raspbian on my Raspberry Pi, I'm using gcc to compile the example project from https://wiki.videolan.org/LibVLC_SampleCode_SDL/
This is my compile command:
gcc -fpermissive test.cpp -lvlc -lsdl1.2-dev -o test
It seems to compile (after I added -fpermissive and manually placed the vlc headers in usr/include/vlc) the error seems to happen during the linking phase, I get these 2 errors;
/usr/bin/ld: cannot find -lvlc
/usr/bin/ld: cannot find -lsdl1.2-dev
I'm a bit new to Linux and I can't work out why it can't find them. I'm also unsure where it installs them by default, there seem to be a few different places they could be.
Use pkg-config to get the needed compile and link flags.
pkg-config --cflags sdl libvlc
will print the needed compilation flags, andpkg-config --libs sdl libvlc
the needed link flags. You can use the$()
feature of the shell to embed the output of pkg-config directly into your compile command. Also, useg++
to compile and link C++ code.gcc
is for C code.The package names
sdl
andlibvlc
correspond to*.pc
files that are installed in/usr/lib/pkgconfig
. If no such files exist, then that means you forgot to install the-dev
versions of the sdl and vlc libraries. So check if there's alibvlc-dev
package you need to install. Use this:See if there's a dev package for libvlc that you need.