Advertisement

Cannot find -lX11

Started by October 08, 2004 03:35 AM
2 comments, last by Captain Tex 20 years, 1 month ago
Hi, I've finally gotten my new computer set up (AMD 64 3000+ and NVIDIA 5200) with SuSE 9.1 Pro. I'm trying to run NeHe's first lesson (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=01 , Linux code by Richard Campbell). However, I receive the following error message when I run the makefile: ct@linux:~/lesson01> make lesson1 gcc -Wall -I/usr/include/ -o lesson1 -L/usr/X11R6/lib lesson1.o -lX11 -lXi -lXmu -lglut -lGL -lGLU -lm /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.3/../../../../x86_64-suse-linux/bin/ld: cannot find -lX11 collect2: ld returned 1 exit status make: *** [lesson1] Error 1 This confuses me because I have the correct libraries in /usr/X11R6/lib. Specifically, libX11.so.6 and libX11.so.6.2. I also have the following Mesa packages installed: XFree86-Mesa, XFree86-Mesa-32bit, XFree86-Mesa-devel, and XFree86-devel-32bit. And addition to that, I have freeglut, freeglut-32bit and freeglut-devel. Anyone have any ideas? I'd really appreciate any help. Lots of thanks, CT
Add -L/usr/X11R6/lib to the linker flags in the Makefile.
The compiler can't find libX11 because it doesn't look in /usr/X11R6/lib . The -L flag followed by a directory, will make gcc look in that directory for libraries.
"THE INFORMATION CONTAINED IN THIS REPORT IS CLASSIFIED; DO NOT GO TO FOX NEWS TO READ OR OBTAIN A COPY." , the pentagon
Advertisement
I think it's already there:

* * * * * * * * *

INCLUDE = -I/usr/include/
LIBDIR = -L/usr/X11R6/lib

COMPILERFLAGS = -Wall
CC = gcc
CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
LIBRARIES = -lX11 -lXi -lXmu -lglut -lGL -lGLU -lm

...

lesson% : lesson%.o
$(CC) $(CFLAGS) -o $@ $(LIBDIR) $< $(LIBRARIES)

* * * * * * * * *

And the command producing the error is:
gcc -Wall -I/usr/include/ -o lesson1 -L/usr/X11R6/lib lesson1.o -lX11 -lXi -lXmu -lglut -lGL -lGLU -lm

* * * * * * * * *

So I'm thinking it should know where the /usr/X11R6/lib directory is right? Maybe I'm just a bit confused or something.

Thanks again,
CT
Ahhh, just figured it out. I had to do -L/usr/X11R6/lib64 instead of -L/usr/X11R6/lib. Whew. Thanks again for your help.

This topic is closed to new replies.

Advertisement