2012-04-06 21 views
0

的功能,我有這樣的低於代碼/root_project/main.cpp只是試圖調用庫

#include "theoraplayer/TheoraVideoClip.h" 

unsigned int tex_id; 
TheoraVideoManager* mgr; 
TheoraVideoClip* clip; 
std::string window_name="glut_player"; 
bool started=1; 
int window_w=800,window_h=600; 

void draw() 
{ 
    glBindTexture(GL_TEXTURE_2D,tex_id); 

    TheoraVideoFrame* f=clip->getNextFrame(); //this gives an error!!! 
    if (f) 
    { 

TheoraVideoClip.h文件是/root_project/include/theoraplayer/

內的TheoraVideoClip.h有這樣的:

TheoraVideoFrame* getNextFrame(); 

,當我嘗試使用g++ -o app main.cpp -lGL -lglut -lGLU 我剛開這個錯誤編譯:

main.cpp:(.text+0xac2): undefined reference to `TheoraVideoClip::getNextFrame()'

任何人都知道爲什麼?

的Ubuntu 11.10

回答

2

您還需要鏈接到libtheoraplayer

+0

哪裏?在編譯命令?我做了'g ++ -o app main.cpp -lGL -lglut -lGLU -libtheoraplayer',但它說'/ usr/bin/ld:找不到-libtheoraplayer'。 – ziiweb 2012-04-06 18:50:23

+0

@tirengarfio:這應該是'-ltheoraplayer',並且由於您似乎將庫設置在非默認位置,因此您可能還需要使用'-L'來指定該位置。 – ildjarn 2012-04-06 19:01:34

+0

我發現這個鏈接http://www.cplusplus.com/forum/beginner/24862/現在我正在寫這個:g ++ -o app main.cpp -lGL -lglut -lGLU -ltheora -ltheoradec但是錯誤是相同.. – ziiweb 2012-04-06 19:47:55