我在Windows 7计算机上使用基于QT 5.0.2的QT Creator 2.7.0,并试图创建一个包含三个子项目的子目录项目。
Project_Dir
- DbManager
- Gui
- Build
使用此处的示例How to use qmakes subdirs template,我创建了下面列出的项目文件,但是,在构建时我不断收到错误LNK1104 Cannot open file 'DbManager.lib'
我的搜索通常是Visual Studio类型修复的结果,但没有QT修复
Project.pro
TEMPLATE = subdirs
SUBDIRS += \
DbManager \
Gui
CONFIG += ordered
SUBDIRS += Build
DbManager.pro
! include( ../common.pri ) {
error( Couldnt find the common.pri file! )
}
HEADERS += dbmanager.h
SOURCES += dbmanager.cpp
Gui.pro
! include( ../common.pri ) {
error( Couldnt find the common.pri file! )
}
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = target
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
Build.pro
TEMPLATE = app
DEPENDPATH += ../Gui
INCLUDEPATH += ../Gui
DEPENDPATH += ../DbManager
INCLUDEPATH += ../DbManager
LIBS += -L../DbManager -L../Gui -lDbManager -lGui
SOURCES += main.cpp
TARGET = ../OptionsTrader
QT += widgets
还包括以下“Common.pri”文件:
INCLUDEPATH += . ..
WARNINGS += -Wall
TEMPLATE = lib
UI_DIR = uics
MOC_DIR = mocs
OBJECTS_DIR = objs
答案 0 :(得分:0)
之前我遇到了同样的问题,我只是将lib文件复制到项目工作目录中,它有效。