linux qt prl文件,qt .prl文件作用

Qt 中.prl文件是为表明依赖库关系而创建的:

Library

Dependencies

Often when linking against a library, qmake relies on the underlying platform to know what other libraries this library links against, and lets the platform pull

them in. In many cases, however, this is not sufficient. For example, when statically linking a library, no other libraries are linked to, and therefore no dependencies to those libraries are created. However, an application that later links against this library

will need to know where to find the symbols that the static library will require. qmake attempts to keep track of the dependencies of a library, where appropriate, if you explicitly enable tracking.

The first step is to enable dependency tracking in the library itself. To do this you must tell qmake to save information about the library:CONFIG += create_prl

This is only relevant to thelibtemplate, and will be ignored for all others. When this option is enabled, qmake will create a file ending in .prlwhich will save some meta-information about the library. This metafile is just like an ordinary project file, but only contains internal variable declarations. When installing this library, by specifying it as a target in anINSTALLSdeclaration, qmake will automatically copy the .prlfile to the installation path.

.prl文件使用:

The second step in this process is to enable reading of this meta information in the applications that use the static library:CONFIG += link_prl

When this is enabled, qmake will process all libraries linked to by the application and find their meta-information. qmake will use this to determine the relevant linking information, specifically adding values to the application project file's list ofDEFINESas well asLIBS. Once qmake has processed this file, it will then look through the newly introduced libraries in theLIBSvariable, and find their dependent .prlfiles, continuing until all libraries have been resolved. At this point, the Makefile is created as usual, and the libraries are linked explicitly against the application.

The .prlfiles should be created by qmake only, and should not be transferred

between operating systems, as they may contain platform-dependent information.

使用.prl文件注意事项:

在使用Qt4.8.6静态库时,发现编译后的静态库lib***.prl文件中QMAKE_PRL_LIBS项,包含编译时的相对全路径,例如:

QMAKE_PRL_LIBS = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib winspool.lib ws2_32.lib ole32.lib user32.lib advapi32.lib msimg32.lib shell32.lib d:\Qt_StaticSrc\qt-everywhere-opensource-src-4.8.6\lib\QtCore.lib

kernel32.lib uuid.lib

导致qmake生成的makefile.debug中包含有

LIBS =...., d:\Qt_StaticSrc\qt-everywhere-opensource-src-4.8.6\lib\QtCore.lib ....

编译提示“找不到d:\Qt_StaticSrc\qt-everywhere-opensource-src-4.8.6\lib\QtCore.lib”。

解决方法:

打开QT库对应***.prl文件,将

QMAKE_PRL_LIBS = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib winspool.lib ws2_32.lib ole32.lib user32.lib advapi32.lib msimg32.lib shell32.lib d:\Qt_StaticSrc\qt-everywhere-opensource-src-4.8.6\lib\QtCore.lib

kernel32.lib uuid.lib

改为

QMAKE_PRL_LIBS = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib winspool.lib ws2_32.lib ole32.lib user32.lib advapi32.lib msimg32.lib shell32.lib$$[QT_INSTALL_LIBS]\QtCore.libkernel32.lib uuid.lib

保存,重新qmake编译即可。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值