How do I remove the library paths that qmake automatically adds to the linker options
Wanted to try using qt creator (coming from eclipse cdt) and I'm trying to get my project to build. Unfortunately, qmake is adding -L/usr/lib to the linker options by itself, making it link to the wrong version of a library, and I can't figure out how to remove it.
I've tried doing "LIBS = " in the project file, as well as "LIBS -= -L/usr/lib", but it seems to be adding the option after it reads the settings from the project file. Anyone know if there's a conf file somewhere (e.g. mkspecs directory) where I ca开发者_开发技巧n comment this out? Thanks.
It comes from qmake itself. It puts qt_libspath
into link flags. It can be changed by either configuring and compiling Qt with a different directory prefix, or by modifying the qmake binary itself.
An easy solution for you could be to create a filesystem-level link to the correct library version with a different name. That is, if you have /usr/lib/libfoo.so
and myfoo/lib/libfoo.so
, create a link libmyfoo.so -> myfoo/lib/libfoo.so
and link with -lmyfoo
instead of -lfoo
.
精彩评论