2017-03-26 61 views
1

我试图用SDL和smpeg制作一个准系统媒体播放器。目前,我唯一的代码如下:链接到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 

我应该如何连接这个不同或其他什么?

回答

1

在我的Debian段盒libsmpeg-dev坚持在/usr/include/smpeg/,不/usr/include/smpeg.h头。

因此,无论在-I/usr/include/smpeg/传递给g++或切换到#include <smpeg/smpeg.h>

请参阅GCC C preprocessor documentation了解它如何搜索头文件。