链接到 smpeg 库

Linking against smpeg library

本文关键字:smpeg 链接      更新时间:2023-10-16

我正在尝试使用 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 库的链接错误,我已经尝试了以下链接命令:

-lSDL2_smpeg
-lSDL_smpeg
-lsmpeg
-libsmpeg

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

sudo apt-get install libsmpeg-dev

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

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

因此,要么传入-I/usr/include/smpeg/ g++,要么切换到#include <smpeg/smpeg.h>.

请参阅 GCC C 预处理器文档,了解如何搜索头文件。