Compiling and linking openGL library code in c-c++ under Linux

Discussion in 'C++' started by shabbir, Aug 9, 2004.

  1. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Talking about C++ we cannot avoid STL and openGL

    For STL you can look at this thread

    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.

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

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice