C++ 使用qt设置odb时出错
我目前正在使用MacOSX10.9.4、ODB2.3.0和Qt5.3 我使用他们的unix指南安装了odb 我试图用qt从他们的站点编译示例(odb-examples-2.3.0),并收到以下错误消息:C++ 使用qt设置odb时出错,c++,qt,odb,C++,Qt,Odb,我目前正在使用MacOSX10.9.4、ODB2.3.0和Qt5.3 我使用他们的unix指南安装了odb 我试图用qt从他们的站点编译示例(odb-examples-2.3.0),并收到以下错误消息: 19:55:15: Running steps for project odbtest... 19:55:15: Configuration unchanged, skipping qmake step. 19:55:15: Starting: "/usr/bin/make" odb --da
19:55:15: Running steps for project odbtest...
19:55:15: Configuration unchanged, skipping qmake step.
19:55:15: Starting: "/usr/bin/make"
odb --database sqlite --profile qt --generate-schema --generate-query --generate-session -I/Applications/Qt/5.3/clang_64/include ../odbtest/employee.hxx
make: odb: No such file or directory
make: *** [employee-odb.cxx] Error 1
19:55:16: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project odbtest (kit: Desktop Qt 5.3.0 clang 64bit)
When executing step "Make"
19:55:16: Elapsed time: 00:00.
My.pro文件如下所示(这几乎是示例的精确副本):
我猜qt找不到odb了。我在qt的info.plist和launchctl中包含了odb的路径,但没有帮助 有什么原因不能将odb可执行文件设置为其绝对路径吗?我对qt比较陌生,我真的不知道在qt中为odb设置路径的位置。我不能说Mac qt包将安装在哪里,但linux包位于/usr/include/qt4中。我可以想象,对于您来说,它将位于与此类似的文件夹中,因为它们都是基于Unix的系统。另外,您使用的是Qt5,因此我将更改路径以表达这一点。
#-------------------------------------------------
#
# Project created by QtCreator 2014-09-07T16:51:45
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = odbtest
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
driver.cxx
HEADERS += mainwindow.h \
database.hxx \
employee.hxx
FORMS += mainwindow.ui
# List of header files that should be compiled with the ODB compiler.
#
ODB_FILES += employee.hxx
# ODB compiler flags.
#
ODB_FLAGS = --database sqlite --profile qt --generate-schema --generate-query --generate-session
# Select the database we are going to use.
#
DEFINES += DATABASE_SQLITE
# Suppress unknown pragmas GCC warnings.
#
QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CXXFLAGS_WARN_ON -Wno-unknown-pragmas
# Link to the ODB runtime libraries.
#
LIBS += -lodb-sqlite
LIBS += -lodb-qt
LIBS += -lodb
# ODB compilation rules. Normally you don't need to change anything here.
#
# Add the Qt headers directory to the ODB include directory list.
#
ODB_FLAGS += -I$$[QT_INSTALL_HEADERS]
# Newer versions of QtCreator do builds in a separate directory. As a
# result, we need to append the source directory to ODB files.
#
for(dir, ODB_FILES) {
ODB_PWD_FILES += $$PWD/$${dir}
}
odb.name = odb ${QMAKE_FILE_IN}
odb.input = ODB_PWD_FILES
odb.output = ${QMAKE_FILE_BASE}-odb.cxx
odb.commands = odb $$ODB_FLAGS ${QMAKE_FILE_IN}
odb.depends = $$ODB_PWD_FILES
odb.variable_out = SOURCES
odb.clean = ${QMAKE_FILE_BASE}-odb.cxx ${QMAKE_FILE_BASE}-odb.hxx ${QMAKE_FILE_BASE}-odb.ixx ${QMAKE_FILE_BASE}.sql
QMAKE_EXTRA_COMPILERS += odb
odbh.name = odb ${QMAKE_FILE_IN}
odbh.input = ODB_PWD_FILES
odbh.output = ${QMAKE_FILE_BASE}-odb.hxx
odbh.commands = @true
odbh.CONFIG = no_link
odbh.depends = ${QMAKE_FILE_BASE}-odb.cxx
QMAKE_EXTRA_COMPILERS += odbh