TheCrifix
TheCrifix

Reputation: 77

Linking against smpeg library

I am trying to make a barebones media player with SDL and smpeg. Currently the only code I have is as follows:

// Header file for SDL
#include "SDL.h"

// This is the header file for the library
#include "smpeg.h"

// Link in the needed libraries
#pragma comment( lib, "sdlmain.lib")
#pragma comment( lib, "sdl.lib")
#pragma comment( lib, "smpeg.lib")

#include "SDL_Movie.h"

int main(int argc, char* argv[])
{
    return 0;
}

However when I attempt to compile this code with the following command I get an error:

g++ sdltest.cpp `pkg-config --clflags --libs sdl2` && ./a.out
Error is: fatal error: smpeg.h: No such file or directory

I believe this is a linking error with smpeg's libs and I have tried the following linking commands:

-lSDL2_smpeg
-lSDL_smpeg
-lsmpeg
-libsmpeg

Please note that I have installed what I think are the correct libs with my package manager:

sudo apt-get install libsmpeg-dev

How should I be linking this differently or whatever?

Upvotes: 1

Views: 319

Answers (1)

genpfault
genpfault

Reputation: 52082

On my Debian Stretch box libsmpeg-dev sticks the smpeg.h header in /usr/include/smpeg/, not /usr/include/.

So either pass in -I/usr/include/smpeg/ to g++ or switch to #include <smpeg/smpeg.h>.

See the GCC C preprocessor documentation for how it searches for header files.

Upvotes: 1

Related Questions