如何将外部库添加到由 Qt Creator RC1(版本 0.9.2)构建的项目中?例如win32函数EnumProcesses()
需要在项目中加入Psapi.lib
才能构建.
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
to be added in the project to build.
正确的做法是这样的:
LIBS += -L/path/to -lpsapi
这样它就可以在 Qt 支持的所有平台上运行.这个想法是您必须将目录与库名称分开(没有扩展名和任何lib"前缀).当然,如果您包含特定于 Windows 的库,这真的无关紧要.
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.
如果您想将 lib 文件存储在项目目录中,您可以使用 $$_PRO_FILE_PWD_
变量引用它们,例如:
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
这篇关于将外部库添加到 Qt Creator 项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!