简体   繁体   中英

Include external library in Qt project indipendently of path

I am developing a C++ app with Qt that depends on the GNU Scientific Library (GSL).

So far, I have linked GSL in the .pro file using LIBS += /path/to/my/GSL/location -l<name_of_the_library> and it works, but it depends on where I installed GSL. I'd like the .pro file not to depend on the user-specific GSL path, and possibly include the precompiled libraries (for different OSes) in the project folder.

Is this possible?

In this case it works on all platforms. You have to separate the directory from the library name

LIBS += -L/path/to -lpsapi

In this case You store your lib files in the project directory.

LIBS += -L"$$_PRO_FILE_PWD_/3rdparty/libs/" -lpsapi

look at this for more: https://doc.qt.io/qtcreator/creator-project-qmake-libraries.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM