1.库所有文件在build路径下
1.include + lib +dll
如openssl库,结构如下
openssl |
include | 头文件 |
lib | libeay32.lib |
ssleay32.lib |
dll | libeay32.dll |
ssleay32.dll |
用法1 | INCLUDEPATH += openssl/include LIBS += -L"openssl/lib" -llibeay32 LIBS += -L"openssl/lib" -lssleay32
|
用法2 | INCLUDEPATH += openssl/include LIBS += -Lopenssl/lib/llibeay32.lib LIBS += -Lopenssl/lib/lssleay32.lib
|
运行时 | exe目录下包含多个dll |
2.include + dll
如zip库,结构如下
quazip |
include | 头文件 |
dll | quazipd.dll |
quazip.dll |
zlib1.dll |
用法 | INCLUDEPATH += quazip/include CONFIG(debug, debug|release) { LIBS += -L"quazip/lib" -lquazipd LIBS += -L"quazip/lib" -lquazip
|
运行时 | exe目录下包含多个dll |
2.库文件的include、lib在项目路径,dll在build路径
情况有所不同,需要前面加$$PWD来指定项目路径,如下
用法 | INCLUDEPATH += $$PWD/quazip/include CONFIG(debug, debug|release) { LIBS += -L"$$PWD/quazip/lib" -lquazipd LIBS += -L"$$PWD/quazip/lib" -lquazip
|
3.实际开发的用法
bin | 实际运行的可执行文件和必须的库文件 |
include | 库相关头文件 |
lib | 调试库(回合bin中有同样的文件) |
src | 项目文件 |
resources | 资源 |
xx.pro |
|
xx.rc | |
项目编译时会有多余的MakeFile、MakeFile.Debug、.qmake.stash,pro.user、qrc_res.cpp等中间文件 其中moc、obj、rcc、ui、.o文件会在bin目录下,需要重新指定路径 多余文件用.gitignore来过滤 |