2017-03-26 48 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瞭解它如何搜索頭文件。