Adding external library into Qt Creator project

后端 未结 8 1990
广开言路
广开言路 2020-11-22 09:39

How can I add external library into a project built by Qt Creator RC1 (version 0.9.2)? For example, the win32 function EnumProcesses() requires Psapi.lib<

8条回答
  •  庸人自扰
    2020-11-22 10:34

    The proper way to do this is like this:

    LIBS += -L/path/to -lpsapi
    

    This way it will work on all platforms supported by Qt. The idea is that you have to separate the directory from the library name (without the extension and without any 'lib' prefix). Of course, if you are including a Windows specific lib, this really doesn't matter.

    In case you want to store your lib files in the project directory, you can reference them with the $$_PRO_FILE_PWD_ variable, e.g.:

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

提交回复
热议问题