libglut.a

I’m not sure if this is the correct place to post, but I’m trying to compile programs on Red Hat 9 using Mesa and glut, but I keep getting complier errors. Here is an example of how I am compiling and the errors I’m getting:

[n0t4h4x0r@DangerMouse glut]# make -f Makefile.linux glut.linux
/usr/bin/cc -o glut.linux glut.o -I/usr/include/GL/ -L/usr/lib/ -lglut -lGLU -lGL
/usr/lib//libglut.a(glut_cindex.o)(.text+0x1a7): In function glutSetColor': : undefined reference to XStoreColor’
/usr/lib//libglut.a(glut_cindex.o)(.text+0x200): In function glutSetColor': : undefined reference to XSetWindowColormap’
/usr/lib//libglut.a(glut_cindex.o)(.text+0x39a): In function glutSetColor': : undefined reference to XStoreColor’
/usr/lib//libglut.a(glut_cindex.o)(.text+0x510): In function glutCopyColormap': : undefined reference to XSetWindowColormap’
/usr/lib//libglut.a(glut_cindex.o)(.text+0x640): In function glutCopyColormap': : undefined reference to XStoreColor’
/usr/lib//libglut.a(glut_cmap.o)(.text+0xc8): In function __glutAssociateNewColormap': : undefined reference to XCreateColormap’
/usr/lib//libglut.a(glut_cmap.o)(.text+0xe8): In function __glutAssociateNewColormap': : undefined reference to XCreateColormap’
/usr/lib//libglut.a(glut_cmap.o)(.text+0x10a): In function __glutAssociateNewColormap': : undefined reference to XAllocColorCells’

Here is what my make file looks like:

.SUFFIXES: .c .cpp .c++

TARGET1 = hello.linux
SRC1 = hello.c
TARGET2 = glut.linux
SRC2 = glut.c
TARGET3 = glutrgb.linux
SRC3 = glutrgb.c

LN = ln -s
MV = mv
RM = -rm -rf

CC = /usr/bin/cc

INCLUDES = -I/usr/include/GL/
LOCAL_LIBS =
LD_LIBS = -L/usr/lib/ -lglut -lGLU -lGL

OBJ1 = $(SRC1:.c=.o)
OBJ2 = $(SRC2:.c=.o)
OBJ3 = $(SRC3:.c=.o)

OBJS = $(OBJ1) $(OBJ2) $(OBJ3)
TARGETS = $(TARGET1) $(TARGET2) $(TARGET3)

.c.o:
        ($(CC) -c $(CFLAGS) $(INCLUDES)  $<)
.cpp.o:
        ($(CC) -c  $(CFLAGS) $(INCLUDES) $<)

$(TARGET1): $(OBJ1)
        $(CC)  $(CFLAGS) -o $@ $(OBJ1) -lm

$(TARGET2): $(OBJ2)
        $(CC)  $(CFLAGS) -o $@ $(OBJ2) $(INCLUDES) $(LOCAL_LIBS) $(LD_LIBS)

$(TARGET3): $(OBJ3)
        $(CC)  $(CFLAGS) -o $@ $(OBJ3) $(INCLUDES) $(LOCAL_LIBS) $(LD_LIBS)

all     : $(TARGET1) $(TARGET2) $(TARGET3)

default : $(all)

clean:
        -$(RM) $(OBJS) $(TARGETS) *~

depend:
        makedepend -f Makefile.linux $(SRCS)

Any help or direction would be greatly appreciated.

I never understood why on some GNU/Linux distributions
I do not have to include -lX11 when I compile with
-lGL -lGLU, etc. It turns out you need something
like that on your system. Make a modification to
the makefile:

add -L/usr/X11R6/lib to the library paths, and
link using -lX11 -lXext -lXm -lXmu or whatever
you need until the errors stop.

Your problem is not really a problem. Really!

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.