Being fairly new to C++ I have a question bascially concerning the g++ compiler and especially the inclusion of libraries. Consider the following makefile:
CPPFLAGS= -I libraries/boost_1_43_0-bin/include/ -I libraries/jpeg-8b-bin/include/
LDLIBS= libraries/jpeg-8b-bin/lib/libjpeg.a
# LDLIBS= -L libraries/jpeg-8b-bin/lib -llibjpeg
all: main
main: main.o
c++ -o main main.o $(LDLIBS)
main.o: main.cpp
c++ $(CPPFLAGS) -c main.cpp
clean:
rm -rf *.o main
As you can see I declared the LDLIBS variable twice. My code is compiling and working if I use the makefile above. But if I deactivate the first LDLIBS entry and active the second one I get ld: library not found for -llibjpeg
. I assume my libjpeg.a
is just not called libjpeg
but bears some different name.
Is there a way to find out the name of a given "libraryfile" libsomething.a
or libsomething.dyn
?
Ok, thanks for all your answers, it is working now. One little question remains: Is it a convention to simply leave out "lib" or is there a standardized way to find out the name?