2012-04-06 20 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