Problem with QJsonValue include QJsonObject



  • I have a problem using QJsonValue and QJsonObject

    even when I add QT+=core. I am using QT 5.5 Does anyone knows what could be the problem.

    Here is mine code:

    Pro file:

    QT += core gui webkit network
    TEMPLATE = app
    SOURCES += main.cpp
    apiservis.cpp
    HEADERS +=
    apiservis.h
    QT = core
    QT -= gui
    QT += webkit
    QT += webkit webkitwidgets
    QT += network
    TARGET = cpp
    CONFIG += console
    CONFIG -= app_bundle
    TARGET = main
    DISTFILES +=
    API_kljuc.txt

    And in the .h file I have:
    #include <QCoreApplication>
    #include <iostream>
    #include <cmath>
    #include <iomanip>
    #include <vector>
    #include <string.h>
    #include <locale>
    #include <sstream>
    #include <fstream>
    #include <string>
    #include <curl/curl.h>
    #include <stdio.h>
    #include <QHash>
    #include <QVariantMap>
    #include <QWebFrame>
    #include <QWebView>
    #include <QNetworkReply>
    #include <QCoreApplication>
    #include <QDebug>
    #include <QNetworkAccessManager>
    #include <QNetworkRequest>
    #include <QUrl>
    #include <QObject>
    #include <QJsonArray>
    #include <QJsonValue>
    #include <QJsonObject>

    But when I try to build it, error is: QJsonARRay:No such file or directory.

    Thanks in advance



  • @selll_93,
    In pro file you have specified the modules twice.
    Comment the following lines.
    QT = core
    QT -= gui
    QT += webkit
    QT += webkit webkitwidgets
    QT += network



  • Thank you on your replay, but that was not the problem. I had QT 4.8 and QT 5.5 installed on my computer, and somehow it called only 4.8


  • Moderators

    @selll_93 said in Problem with QJsonValue include QJsonObject:

    I had QT 4.8 and QT 5.5 installed on my computer, and somehow it called only 4.8

    1. Make sure Qt is not in your system PATH.
    2. If you are building from the command line, make sure you run qmake from Qt 5.5, not Qt 4.8.
    3. If you are building from Qt Creator, make sure your project is set up to use Qt 5.5, not Qt 4.8: http://doc.qt.io/qtcreator/creator-configuring-projects.html

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.