To compile my app in Linux, I''m using a Makefile, the contents being the following:
SOURCE=main.cpp
EXEC=game
CC=gcc
FLAGS=-Wall
INCPATH=-I/usr/X11R6/include -I/usr/local/include
LIBPATH=-L/usr/X11R6/lib -L/usr/local/lib
LIBS=-lglut -lGLU -lGL
${EXEC}: ${SOURCE}
${CC} ${FLAGS} -o ${EXEC} {$SOURCE} ${INCPATH} ${LIBPATH} ${LIBS}
clean:
rm -f game
However, I run ''make'', and I get the following compilation error:
/usr/bin/ld: cannot find -lGLU
collect2: ld returned 1 exit status
make: *** [game] Error 1
Could anyone please help me figure out why I get this error? My understanding is that I need the .so file... I have both libGLU.so.1.2 and libGLU.so.1.3.500, but I''m not sure if there''s something I have to do to "register" these files, or something along those lines. What do I do? Thanks!!
You shouldn''t have two different versions of the library, but as long as they''re in the same folder (/usr/X11R6/lib, I''d guess) it doesn''t hurt anything.
As root, run ldconfig in a terminal, and then make sure a libGLU.so symlink was created that points at the full libGLU.so.version file. That should be all that''s needed.
I tried running ldconfig, but it did not correct the error. Unfortunately I do not have the /usr/X11R6/lib/libGLU.a file. I guess I will have to find it or something. Hopefully I can figure this out, as I want to be able to code projects for porting between Windows and Linux.
first make sure you have the symlinks libGLU.so and libGLU.so.1 which both link to the libGLU.so.1.2 (take the latest).
Then run ldconfig -v , the v flag will make ldconfig print all the libraries found, check to see if you can find libGLU.so (or something like that) in the output. If you find it try to compile (it should work).
If you don''t find it, look into the file /etc/ld.so.conf . This file contains all the paths where ldconfig will look for libraries. If /usr/X11R6/lib isn''t in that list, add it. Then rerun ldconfig and see if it finds libGLU. Now it should work.
"THE INFORMATION CONTAINED IN THIS REPORT IS CLASSIFIED; DO NOT GO TO FOX NEWS TO READ OR OBTAIN A COPY." , the pentagon
You usually need to install the development packages to be able to compile software. The linker uses the .a files to build to executable. After the executable is compiled, you only need the .so (dynamic libraries) to run software.
I would advise that first Mattman tries install the XFree86-devel package. That should install all of the headers and libs to allow him compile software.
Hey, thanks for the replies. George2''s reply worked for my. I used ''ln -s [orig_filename] [link_filename]'', then I ran ''ldconfig'', and that did the trick. (Actually, I don''t think ldconfig was even needed once I used ln -s.) I needed to create ''[filename].so'' link files that pointed to the ''[filename].so.version_number'' files. Thanks again to everyone for the help!
quote:Original post by Anonymous Poster The linker uses the .a files to build to executable. After the executable is compiled, you only need the .so (dynamic libraries) to run software.
.a files are archives aka static libraries. If you link with a static library the appropriate library functions are included in your executable and the shared library is not used. GCC will link with shared libraries (if available) by default on systems that are capable of using shared libraries.