开发者

simple openGL program fails to link in ubuntu

i'm trying to get into opengl programming, but fail to compile my first very very simple program. the linking process fails every time. i found this answer on stackoverflow, and have had all packages installed and told g++ which libraries to link against.

here's my sample program:

#include <GL/glut.h>
#include <GL/gl.h>

int main(int argc, char **argv) {
  glutInit(&argc, argv);
  return 0;
}

compiling results in the following error from the linker:

$ g++ -Wall -lglut -lGL -lGLU 开发者_JAVA技巧opengl.cpp
/tmp/cc1UAFPU.o: In function `main':
opengl.cpp:(.text+0x3b): undefined reference to `glutInit'
collect2: ld returned 1 exit status

anybody got any idea on this issue? there must be something which i am missing, but i just cannot see what. any hints to resolve this issue are highly appreciated!


might be order - either reorder libs, or put them after opengl.cpp

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜