Jump to content
  • Advertisement
Sign in to follow this  
Captain Tex

Cannot find -lX11

This topic is 4975 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!