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
    评论
关于Qt和Excel的使用,您提到了QtXlsx这个库和VS2017。在使用QtXlsx库时,您需要执行以下步骤: 1. 将QtXlsx的头文件拷贝到您的Qt安装目录的include文件夹下。具体路径可能因您的Qt安装目录、编译器选择和使用的编译器而有所不同。 2. 将QtXlsx的源代码的头文件拷贝到Qt安装目录的include/QtXlsx文件夹下。 3. 将QtXlsx的库文件Qt5Xlsx.lib,Qt5Xlsxd.lib,Qt5Xlsx.prlQt5Xlsxd.prl)拷贝到Qt安装目录的lib文件夹下。 4. 将QtXlsx的动态链接库文件Qt5Xlsx.dll,Qt5Xlsxd.dll)拷贝到Qt安装目录的bin文件夹下。 5. 将QtXlsx的mkspecs/modules文件qt_lib_xlsx.pri文件拷贝到Qt安装目录的mkspecs/modules文件夹下。 完成上述步骤后,您可以在您的Qt项目添加QtXlsx的文件,以便进行Excel文件的操作。 关于操作Excel文件,您提供了一段代码。该代码使用QXlsx库来创建一个Excel文件并写入数据。首先,通过文件对话框选择保存的文件路径,并创建一个QXlsx::Document对象来表示Excel文件。接下来,您可以定义一些单元格的格式,如背景颜色。然后,使用循环将数据写入Excel文件的不同单元格,并设置列宽。最后,通过调用save()方法保存Excel文件。 总而言之,Qt和Excel可以通过使用QtXlsx库来实现相互操作。在使用该库时,您需要将库的头文件和库文件添加到Qt的安装目录,并在项目包含相关文件。然后,您可以使用QXlsx库提供的功能来操作Excel文件。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值