LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Linker problem: can't find a file, but the file exists (http://www.linuxquestions.org/questions/programming-9/linker-problem-cant-find-a-file-but-the-file-exists-218189/)

atlep 08-16-2004 06:30 AM

Linker problem: can't find a file, but the file exists
 
Hello everybody. I'm new here, searching for knowledgable forum to post my linux problems. This is the third forum I try to get help for the following problem.

I try to compile a simple GL-program using glut. But even though the libraries should be installed, the linker cannot find them. Here's an illustration:

Code:

$ gcc simplegl.o -L /usr/X11R6/lib/ -lGL -lGLU -lglut -o simplegl
 /usr/bin/ld: cannot find -lglut
 collect2: ld returned 1 exit status
 
 $ locate libglut
 /usr/X11R6/lib/libglut.so.3
 /usr/X11R6/lib/libglut.so.3.7.1
 
 # ldconfig -p | grep glut
libglut.so.3 (libc6) => /usr/X11R6/lib/libglut.so.3

As you can see, libglut exits, but the linker still claims it can't find it. Why might that be?

Some extra, possibly relevant, information:
Dist: Mandrake 10.0
The glut libs were installed from the distribution. However, the header files were not. So these are copied from: [cannot post url before five posts] www_ibiblio_org/pub/packages/development/graphics/glut/glut-3.5.tar.gz

I hope someone can help me, since all simple 'getting started' openGL examples seem to be using glut.

infamous41md 08-16-2004 06:40 AM

i'm not sure what's going on there, but if you want to workaround w/e is going on, just pass the shared lib on command line, ie:
gcc simplegl.o -L /usr/X11R6/lib/ -lGL -lGLU -o simplegl /usr/X11R6/lib/libglut.so.3

atlep 08-16-2004 06:48 AM

Thank you, that worked liked a charm. The program even executed perfectly! :)

I would still like to know if someone has any ideas about the problem posted, though. As I am sure an answer to this would provide me with some more understanding about how the compiler and linker works.

I will be happy to follow this thread and try most suggestions, in order to work out the problem.

Yeah, and it looks like I found my forum :)

infamous41md 08-16-2004 06:52 AM

stupid un deletable posts damn you

infamous41md 08-16-2004 06:53 AM

http://www.linuxquestions.org/questi...hreadid=210728

atlep 08-16-2004 07:15 AM

I looked through the page, but couldn't find anything directly related to my problem. Since your above suggestion worked, it does not appear that I need to link any other libraries. And it also proves that the library is where it should be.

The only thing I can think of is some ....... (where's a light-bulb smilie when you need one)

Yep, and problem is solved :) It seems the linker needs to find libglut.so and that libglut.so.3 was not enough. Would've thought the Mandrake distribution should've created that symlink when installing the libraries. :confused:

Anyways, thanks for your help. A little reading around the problem helped kick-start the necessary brain cells.


All times are GMT -5. The time now is 03:56 PM.