问题描述
如何将外部库添加到由 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设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)