gcc -l option and .la library files

0xDEAD BEEF picture 0xDEAD BEEF · Jun 18, 2010 · Viewed 14.6k times · Source

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.

Answer

rubenvb picture rubenvb · Jun 18, 2010

.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.