LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-30-2004, 08:03 PM   #1
Chryzmo
Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware 10.1
Posts: 180

Rep: Reputation: 30
gcc -lGLU Flag Gives An Error


Heyas,

I was trying to compile the source code from NeHe's seconds OpenGL Lesson. When I try to compile the source using the included make file, I get the following error:

$ make
gcc -Wall -ansi lesson02.c -o lesson02 -lGL -lGLU `sdl-config --cflags --libs`
/usr/lib/gcc-lib/i486-slackware-linux/3.3.4/../../../../i486-slackware-linux/bin/ld: cannot find -lGLU
collect2: ld returned 1 exit status
make: *** [all] Error 1

When I try to compile the same source file without the -lGLU tag, I get the following error:
$ gcc lesson02.c -o lesson02 -lSDL -lSDLmain -lGL
/tmp/ccQNySIB.o(.text+0x8a): In function `resizeWindow':
: undefined reference to `gluPerspective'
collect2: ld returned 1 exit status

If I go in and comment this line out, everything compiles, however the program does nothing. It is just a blank screen. So, I've narrowed down the problem and I think it is because the gluPerspective requires the -lGLU flag, but it will not work. I am running Slackware 10.0 and my gcc is version 3.3.4. Is there a package I do not have that I need to install to get the -GLU flag to work so I can compile these sample programs?

Thanks,
Chris
 
Old 09-30-2004, 09:00 PM   #2
Chryzmo
Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware 10.1
Posts: 180

Original Poster
Rep: Reputation: 30
I just managed to get this to work. For anyone else who might be having a problem like this, my libGLU files were in /usr/X11R6/lib/ and not /usr/lib/ and aparently gcc looks for the files in /usr/lib/ unless told otherwise. So I just copied them from /usr/X11R6/lib/ to /usr/lib and now the -lGLU flag works with gcc and the lessons compile without a problem.

-Chris-
 
Old 09-30-2004, 09:22 PM   #3
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
Congrats on figuring out your own problem, but your solution is not quite the best...

When you copy libraries from their proper location to another, you set yourself up for problems later on. Your package manager (or make install if you compile from source) is going to replace the /usr/X11R6 files, but it's not going to know about the files in /usr/lib, yet these files will be used when you compile your program (so if you upgrade to fix a problem and forget to recopy those files, you won't see the problem go away!).

You could get around this by providing symlinks to the files, but the best way is to use gcc's -L switch. -L /usr/X11R6/lib would tell the system to search in that directory (as well as the defaults) for libraries when building the program.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I got a error flag "init: /dev/initctl: no such file" mst700 Linux - Newbie 4 10-28-2007 08:00 AM
mount_smbfs authentication error with -N flag xaenn *BSD 1 11-18-2005 04:49 PM
in gcc compiler error: parse error before string constsnt cynthia_thomas Linux - Networking 1 10-20-2005 01:29 AM
compiling problem (cannot find -lGLU) zeadriche Programming 3 06-29-2004 10:12 AM
Error - GCC rapidmaniac Linux - Software 6 04-29-2004 06:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration