Cannot find -lX11
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 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
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
* * * * * * * * *
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement