Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcc -l option and .la library files

Tags:

c++

gcc

shared

Could you please explain, how linking with -l option against .la files works?

As far as my experience reaches - i have only linked against static library (.a) files.

Now i took a look at some Qt generated Makefiles and cant figure out, how linker figures out to use/open libQtCore.la file, when -l QtCore switch is specified, instead of looking for libQtCore.a.

Also - gcc manual states, that -l[library name] switch will include lib[library name].a, not lib[libraryname].la.

like image 226
0xDEAD BEEF Avatar asked Jun 18 '10 08:06

0xDEAD BEEF


1 Answers

.la files are as far as I know libtool junk and shouldn't be linked to manually. They are used internally by libtool for whatever reason it needs them. You should link to the *.a file. In a Qt install/build there should be *.a files to link to.

like image 187
rubenvb Avatar answered Nov 03 '22 00:11

rubenvb