Subject: Re: error in linking with glut.(undefined _glutSawpBuffers)
To: Richard PLOIX <richard.ploix@fr.adp.com>
From: Richard Rauch <rkr@rkr.kcnet.com>
List: netbsd-help
Date: 05/31/2000 14:41:21
Does the program use any other GLUT calls?  If so, and if you delete the
call(s) to glutSwapBuffers(), what happens when you try to compile?  (The
purpose of this question is to determine whether you are actually linking
against the glut library; the error SOUNDS like you have somehow not
linked against it.)

I seem to need the Xmu and Xext libraries as well, in order to produce a
usable program (at least with Mesa 3.0 and 3.1).  Failure to link with
these should in no way cause the problem that you saw, however.

You might also try a less ``fancy'', but more direct, Makefile.  If you
are trying to compile a pair of source files, cube.c and main.c, you might
write your Makefile as follows:

 /~~~ Makefile

IDIR   = -I/usr/X11/include
LDIR   = -L/usr/X11R6/lib
XLIBS  = -lX11 -lXmu -lXext
GLBASE = -lglut -lGLU -lGL
CC     = gcc -O2 -Wall
COMP   = $(CC) -c
LINK   = $(CC)

all : cube

cube : cube.o main.o
        $(LINK) -o cube cube.o main.o $(LDIR) $(GLBASE) $(XLIBS) -lm

cube.o : cube.c
	$(COMP) $(IDIR) -o cube.o cube.c

main.o : main.c
	$(COMP) $(IDIR) -o main.o main.c

clean :
        rm -f *.o cube *~

 \___ Makefile

(The above is derived from a Makefile that I used for a graphics course
last fall---it had to work on my machine (NetBSD) and the lab machines
(SGI boxes).  For small projects, keeping the Makefiles down to basics
isn't really any more work, and you get the bonus of knowing that the
Makefile is transportable to other systems.  Of course, if you start
working on larger programs (more than a few source files), you probably
will want to make more use of your local make's special features.)

(Note that the indented lines are indented by _tab_ characters, not
spaces.  Many makes require tab characters; none refuse to accept
tab-indented lines.)


If you just have a cube.c, remove the main.o : main.c production, and
delete references to main.o in the cube : cube.o main.o production.  If
you are using C++ rather than C, changes the CC line to use g++ in place
of gcc.


Let me know if you try any of the above, and if so what results you get.

(ramble)


  "I probably don't know what I'm talking about."  --rkr@rkr.kcnet.com