将外部库添加到Qt Creator项目中 [英] Adding external library into Qt Creator project

查看:199
本文介绍了将外部库添加到Qt Creator项目中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将外部库添加到由Qt Creator RC1(0.9.2版)构建的项目中?例如,win32函数 EnumProcesses()需要 Psapi.lib 才能添加到要构建的项目中。 p>

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特定的lib,这真的没有关系。

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项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆