我正在尝试在Qt Creator中创建的应用程序中使用QJson库。操作系统是Ubuntu 12.04 32位。
我使用了synaptic来安装libqjson0(0.7.1-6)。该库已安装在
中/usr/lib/i386-linux-gnu/libqjson.so.0
/usr/lib/i386-linux-gnu/libqjson.so.0.7.1
我尝试通过右键单击我的项目并选择“添加库...”将库添加到Qt Creator。当我输入上面显示的2个路径中的任何一个时,文件名为红色,表示它不正确。我创建了一个链接到libqjson.so.0.7.1的符号链接 libqjson.so 。我现在可以使用/usr/lib/i386-linux-gnu/libqjson.so路径添加库。
现在对于noob问题:在应用程序的顶部我添加了#include< parser.h>。我得到一个错误'parser.h:没有这样的文件或目录。我在/ usr / libs / i386-linux-gnu中搜索了parser.h并且没有返回任何结果。我需要在parser.h之前添加一些东西吗?还是我错过了其他东西?
编辑: .pro文件附在
下面#-------------------------------------------------
#
# Project created by QtCreator 2012-10-05T20:40:21
#
#-------------------------------------------------
QT += core gui
QT += network
TARGET = zf
TEMPLATE = app
SOURCES += main.cpp\
zftest.cpp \
api1_6.cpp
HEADERS += zftest.h \
api1_6.h
FORMS += zftest.ui
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../usr/lib/qt4/plugins/crypto/release/ -lqca-ossl
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../usr/lib/qt4/plugins/crypto/debug/ -lqca-ossl
else:symbian: LIBS += -lqca-ossl
else:unix: LIBS += -L$$PWD/../../../../../../usr/lib/qt4/plugins/crypto/ -lqca-ossl
INCLUDEPATH += $$PWD/../../../../../../usr/lib/qt4/plugins/crypto
DEPENDPATH += $$PWD/../../../../../../usr/lib/qt4/plugins/crypto
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../usr/lib/release/ -lqca
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../usr/lib/debug/ -lqca
else:symbian: LIBS += -lqca
else:unix: LIBS += -L$$PWD/../../../../../../usr/lib/ -lqca
INCLUDEPATH += $$PWD/../../../../../../usr/include
DEPENDPATH += $$PWD/../../../../../../usr/include
OTHER_FILES += \
README.txt
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../usr/lib/i386-linux-gnu/release/ -lqjson
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../usr/lib/i386-linux-gnu/debug/ -lqjson
else:symbian: LIBS += -lqjson
else:unix: LIBS += -L$$PWD/../../../../../../usr/lib/i386-linux-gnu/ -lqjson
INCLUDEPATH += $$PWD/../../../../../../usr/lib/i386-linux-gnu
DEPENDPATH += $$PWD/../../../../../../usr/lib/i386-linux-gnu
答案 0 :(得分:4)
您还需要 libjson-dev 包。基于deb的分发版通常在* -dev包中提供包含文件。
安装完成后,你会在/ usr / include / qjson中找到parser.h和其他标题。
答案 1 :(得分:0)
.pro文件中缺少这些行:
INCLUDEPATH += folderwhereisinstalled/qjson/include
LIBS += -Lfolderwhereisinstalled/qjson/lib -lqjson