链接smpeg库

时间:2017-03-26 17:51:30

标签: c++ sdl sdl-2

我正在尝试使用SDL和smpeg制作一个准系统媒体播放器。目前我唯一的代码如下:

// 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;
}

但是,当我尝试使用以下命令编译此代码时,出现错误:

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

我相信这是与smpeg的libs的链接错误,我尝试了以下链接命令:

-lSDL2_smpeg
-lSDL_smpeg
-lsmpeg
-libsmpeg

请注意我已经使用我的软件包管理器安装了我认为正确的库:

sudo apt-get install libsmpeg-dev

我应该如何以不同方式或其他方式进行链接?

1 个答案:

答案 0 :(得分:1)

在我的Debian Stretch框中libsmpeg-devsmpeg.h标题粘贴到/usr/include/smpeg/,而不是/usr/include/

所以要么将-I/usr/include/smpeg/传递给g++,要么切换到#include <smpeg/smpeg.h>

请参阅GCC C preprocessor documentation了解搜索头文件的方式。