红联Linux门户
Linux帮助

[ogl] compile OpenGL code in linux

发布时间:2008-10-09 00:05:39来源:红联作者:noenil
Can't use any IME in my Fedora, so English comes here.

Following are what I found useful, copy&paste them here.

Newbie in opengl under linux platform face the difficulty in compiling the c++ code and linking the libraries like GLUT, GL, GLU. The best way to avoid the problem is to create a make file which can compile any GCC c++ source file and produce the output file.

CC = gcc
GCCFLAGS = -O
INCLUDE = -I. -I/usr/include
FILENAME = zbuffer
LDLIBS = -lglut -lXext -lX11 -lXmu -lXi -lGL -lGLU -lm -lSDL -lSDL_mixer -lpthread
LDFLAGS = -L/usr/X11R6/lib -L/usr/lib -L/lib
program:
$(CC) $(GCCFLAGS) $(INCLUDE) $(FILENAME).cpp $(LDFLAGS) $(LDLIBS) -o $(FILENAME)

In my Fedora, initializing OpenGL by SDL, I found '-lGL -lglut -lSDL -lpthread' are just work.
文章评论

共有 1 条评论

  1. tayer_young 于 2008-11-04 19:10:36发表:

    0:w(5( 0:w(5(