Can't add jsoncpp library in Qt Creator

99 Views Asked by At

I've installed jsoncpp via vcpkg. I tryed to add the library in Qt Creator by Right click->Add library and selecting path to jsoncpp.lib, but I get

No rule to make target 'E:/Qt/projects/test/../../../cpp/libs/vcpkg/installed/x86-windows/lib/libjsoncpp.a', needed by 'release/test.exe'. Stop.

with any library I add.

.pro file:

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = test
TEMPLATE = app

CONFIG += c++11

SOURCES += \
        main.cpp \
        mainwindow.cpp

HEADERS += \
        mainwindow.h

FORMS += \
        mainwindow.ui

qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

win32: LIBS += -L$$PWD/../../../cpp/libs/vcpkg/installed/x86-windows/lib/ -ljsoncpp

INCLUDEPATH += $$PWD/../../../cpp/libs/vcpkg/installed/x86-windows/include
DEPENDPATH += $$PWD/../../../cpp/libs/vcpkg/installed/x86-windows/include

win32:!win32-g++: PRE_TARGETDEPS += $$PWD/../../../cpp/libs/vcpkg/installed/x86-windows/lib/jsoncpp.lib
else:win32-g++: PRE_TARGETDEPS += $$PWD/../../../cpp/libs/vcpkg/installed/x86-windows/lib/libjsoncpp.a

I also tryed:

LIBS += E:/cpp/libs/vcpkg/installed/x86-windows/lib/jsoncpp.lib
INCLUDEPATH += E:/cpp/libs/vcpkg/installed/x86-windows/include/

When I use the library:

Json::Value value;

I get:

undefined reference to `Json::Value::Value(Json::ValueType)'
undefined reference to `Json::Value::~Value()'

but it works with other libraryes.

Qt version: 5.12.2

0

There are 0 best solutions below