Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Problem installing Qt Charts
Forum Updated to NodeBB v4.3 + New Features

Problem installing Qt Charts

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
14 Posts 6 Posters 22.0k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • p3c0P Offline
    p3c0P Offline
    p3c0
    Moderators
    wrote on last edited by
    #4

    @JosephC Add QT += charts in your .pro file and Run qmake.

    157

    J 1 Reply Last reply
    1
    • p3c0P p3c0

      @JosephC Add QT += charts in your .pro file and Run qmake.

      J Offline
      J Offline
      JosephC
      wrote on last edited by
      #5

      @p3c0
      I have done that. That's my problem. Here is the answer:
      error: Unknown module(s) in QT: charts

      jsulmJ 1 Reply Last reply
      0
      • J JosephC

        @p3c0
        I have done that. That's my problem. Here is the answer:
        error: Unknown module(s) in QT: charts

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #6

        @JosephC Did you install QtCharts after updating to 5.7? It looks like it is not installed by default and is listed as a module under Qt5.7 node in Qt Maintenance Tool.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1
        • pauleddP Offline
          pauleddP Offline
          pauledd
          wrote on last edited by
          #7

          I have the same problem. I just downloaded qt-everywhere-opensource-src-5.7.0.tar.gz, then I did:

          ./configure --prefix=$PWD/qtbase -opensource -nomake tests -confirm-license -c++std c++11 -qt-sql-sqlite -plugin-sql-sqlite -system-sqlite
          make -j4
          make install
          

          run through without issues.
          Then I added the base path manualy to QT Versions
          qt image
          then set it to default:
          alt text
          my project file:

          #-------------------------------------------------
          #
          # Project created by QtCreator 2016-09-26T09:00:37
          #
          #-------------------------------------------------
          
          QT       += core gui charts
          
          greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
          
          TARGET = fileDialogTest
          TEMPLATE = app
          
          
          SOURCES += main.cpp\
                  mainwindow.cpp
          
          HEADERS  += mainwindow.h
          
          FORMS    += mainwindow.ui
          

          when I build it I get "cannot find -lQt5Charts":

          09:43:45: Starting: "/usr/bin/make" 
          g++ -Wl,-rpath,/home/paul/build/qt-everywhere-opensource-src-5.7.0/qtbase/lib -o fileDialogTest main.o mainwindow.o moc_mainwindow.o   -L/home/paul/build/qt-everywhere-opensource-src-5.7.0/qtbase/lib -lQt5Charts -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread 
          /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lQt5Charts
          Makefile:318: recipe for target 'fileDialogTest' failed
          collect2: error: ld returned 1 exit status
          make: *** [fileDialogTest] Error 1
          09:43:45: The process "/usr/bin/make" exited with code 2.
          Error while building/deploying project fileDialogTest (kit: QT 5.7.0)
          When executing step "Make"
          09:43:45: Elapsed time: 00:00.
          

          When I sear for it in the base dir I get:

          find build/qt-everywhere-opensource-src-5.7.0/qtbase/ -name '*Charts*'
          build/qt-everywhere-opensource-src-5.7.0/qtbase/lib/cmake/Qt5Charts
          build/qt-everywhere-opensource-src-5.7.0/qtbase/lib/cmake/Qt5Charts/Qt5ChartsConfigVersion.cmake
          build/qt-everywhere-opensource-src-5.7.0/qtbase/lib/cmake/Qt5Charts/Qt5ChartsConfig.cmake
          build/qt-everywhere-opensource-src-5.7.0/qtbase/lib/libQt5Charts.prl
          build/qt-everywhere-opensource-src-5.7.0/qtbase/lib/pkgconfig/Qt5Charts.pc
          build/qt-everywhere-opensource-src-5.7.0/qtbase/lib/libQt5Charts.la
          build/qt-everywhere-opensource-src-5.7.0/qtbase/include/QtCharts
          build/qt-everywhere-opensource-src-5.7.0/qtbase/include/QtCharts/QtChartsDepends
          build/qt-everywhere-opensource-src-5.7.0/qtbase/qml/QtCharts
          

          did I miss something?

          jsulmJ 1 Reply Last reply
          0
          • pauleddP Offline
            pauleddP Offline
            pauledd
            wrote on last edited by
            #8

            I solved my problem. I had to extra build QtCharts from the source directory so it does not get built and installed by default configure/build of qtbase:

            cd qt-everywhere-opensource-src-5.7.0/qtcharts
            ../qtbase/bin/qmake
            make -j4
            make install
            

            After that I was able to build my Project.

            1 Reply Last reply
            0
            • pauleddP pauledd

              I have the same problem. I just downloaded qt-everywhere-opensource-src-5.7.0.tar.gz, then I did:

              ./configure --prefix=$PWD/qtbase -opensource -nomake tests -confirm-license -c++std c++11 -qt-sql-sqlite -plugin-sql-sqlite -system-sqlite
              make -j4
              make install
              

              run through without issues.
              Then I added the base path manualy to QT Versions
              qt image
              then set it to default:
              alt text
              my project file:

              #-------------------------------------------------
              #
              # Project created by QtCreator 2016-09-26T09:00:37
              #
              #-------------------------------------------------
              
              QT       += core gui charts
              
              greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
              
              TARGET = fileDialogTest
              TEMPLATE = app
              
              
              SOURCES += main.cpp\
                      mainwindow.cpp
              
              HEADERS  += mainwindow.h
              
              FORMS    += mainwindow.ui
              

              when I build it I get "cannot find -lQt5Charts":

              09:43:45: Starting: "/usr/bin/make" 
              g++ -Wl,-rpath,/home/paul/build/qt-everywhere-opensource-src-5.7.0/qtbase/lib -o fileDialogTest main.o mainwindow.o moc_mainwindow.o   -L/home/paul/build/qt-everywhere-opensource-src-5.7.0/qtbase/lib -lQt5Charts -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread 
              /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lQt5Charts
              Makefile:318: recipe for target 'fileDialogTest' failed
              collect2: error: ld returned 1 exit status
              make: *** [fileDialogTest] Error 1
              09:43:45: The process "/usr/bin/make" exited with code 2.
              Error while building/deploying project fileDialogTest (kit: QT 5.7.0)
              When executing step "Make"
              09:43:45: Elapsed time: 00:00.
              

              When I sear for it in the base dir I get:

              find build/qt-everywhere-opensource-src-5.7.0/qtbase/ -name '*Charts*'
              build/qt-everywhere-opensource-src-5.7.0/qtbase/lib/cmake/Qt5Charts
              build/qt-everywhere-opensource-src-5.7.0/qtbase/lib/cmake/Qt5Charts/Qt5ChartsConfigVersion.cmake
              build/qt-everywhere-opensource-src-5.7.0/qtbase/lib/cmake/Qt5Charts/Qt5ChartsConfig.cmake
              build/qt-everywhere-opensource-src-5.7.0/qtbase/lib/libQt5Charts.prl
              build/qt-everywhere-opensource-src-5.7.0/qtbase/lib/pkgconfig/Qt5Charts.pc
              build/qt-everywhere-opensource-src-5.7.0/qtbase/lib/libQt5Charts.la
              build/qt-everywhere-opensource-src-5.7.0/qtbase/include/QtCharts
              build/qt-everywhere-opensource-src-5.7.0/qtbase/include/QtCharts/QtChartsDepends
              build/qt-everywhere-opensource-src-5.7.0/qtbase/qml/QtCharts
              

              did I miss something?

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #9

              @pauledd Do you really need to build Qt by yourself? Qt 5.7 binaries already contain QtCharts - you can install both using Qt Maintenance Tool.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • pauleddP Offline
                pauleddP Offline
                pauledd
                wrote on last edited by
                #10

                @jsulm I used no binaries, I compiled everything from source. But it still doesnt work. I cant create a QLineSeries Object.

                ../fileDialogTest/mainwindow.cpp:27:2: error: 'QLineSeries' was not declared in this scope
                  QLineSeries *a = new QLineSeries();
                  ^
                ../fileDialogTest/mainwindow.cpp:27:2: note: suggested alternative:
                In file included from ../../build/qt-everywhere-opensource-src-5.7.0/qtcharts/include/QtCharts/qlineseries.h:1:0,
                                 from ../../build/qt-everywhere-opensource-src-5.7.0/qtcharts/include/QtCharts/QtCharts:28,
                                 from ../fileDialogTest/mainwindow.cpp:4:
                ../../build/qt-everywhere-opensource-src-5.7.0/qtcharts/include/QtCharts/../../src/charts/linechart/qlineseries.h:41:24: note:   'QtCharts::QLineSeries'
                 class QT_CHARTS_EXPORT QLineSeries : public QXYSeries
                

                I will try the binaries now.

                1 Reply Last reply
                0
                • pauleddP Offline
                  pauleddP Offline
                  pauledd
                  wrote on last edited by
                  #11

                  Maybe I choose the wrong license? I just read that QtCharts is available in GPLV2/GPLV3 but NOT in LGPLV3.

                  1 Reply Last reply
                  0
                  • pauleddP Offline
                    pauleddP Offline
                    pauledd
                    wrote on last edited by
                    #12

                    I tried the binary package but I get the same error.
                    project file:

                    SOURCES += \
                        main.cpp
                    CONFIG += qt 
                    QT += core gui charts
                    
                    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
                    
                    

                    main.cpp:

                    #include <QApplication>
                    #include <QLineSeries>
                    #include <QChartView>
                    int main(int argc, char **argv){
                    	QApplication app(argc,argv);
                    	
                    	QLineSeries *ls = new QLineSeries;
                    	
                    	return app.exec();
                    }
                    

                    output:

                    11:29:40: Starting: "/usr/bin/make" 
                    g++ -c -pipe -g -std=gnu++11 -D_REENTRANT -Wall -W -fPIC -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_QML_DEBUG -I../chartsTest2 -I. -I/home/paul/store/build/Qt5.7.0/5.7/gcc_64/include -I/home/paul/store/build/Qt5.7.0/5.7/gcc_64/include/QtCharts -I/home/paul/store/build/Qt5.7.0/5.7/gcc_64/include/QtWidgets -I/home/paul/store/build/Qt5.7.0/5.7/gcc_64/include/QtGui -I/home/paul/store/build/Qt5.7.0/5.7/gcc_64/include/QtCore -I. -I/home/paul/store/build/Qt5.7.0/5.7/gcc_64/mkspecs/linux-g++ -o main.o ../chartsTest2/main.cpp
                    ../chartsTest2/main.cpp: In function 'int main(int, char**)':
                    ../chartsTest2/main.cpp:7:2: error: 'QLineSeries' was not declared in this scope
                      QLineSeries *ls = new QLineSeries;
                      ^
                    ../chartsTest2/main.cpp:7:2: note: suggested alternative:
                    In file included from /home/paul/store/build/Qt5.7.0/5.7/gcc_64/include/QtCharts/QLineSeries:1:0,
                                     from ../chartsTest2/main.cpp:2:
                    /home/paul/store/build/Qt5.7.0/5.7/gcc_64/include/QtCharts/qlineseries.h:41:24: note:   'QtCharts::QLineSeries'
                     class QT_CHARTS_EXPORT QLineSeries : public QXYSeries
                                            ^
                    ../chartsTest2/main.cpp:7:15: error: 'ls' was not declared in this scope
                      QLineSeries *ls = new QLineSeries;
                                   ^
                    ../chartsTest2/main.cpp:7:24: error: 'QLineSeries' does not name a type
                      QLineSeries *ls = new QLineSeries;
                                            ^
                    Makefile:658: recipe for target 'main.o' failed
                    make: *** [main.o] Error 1
                    11:29:41: The process "/usr/bin/make" exited with code 2.
                    Error while building/deploying project chartsTest2 (kit: Desktop Qt 5.7.0 GCC 64bit)
                    When executing step "Make"
                    11:29:41: Elapsed time: 00:02.
                    
                    1 Reply Last reply
                    0
                    • pauleddP Offline
                      pauleddP Offline
                      pauledd
                      wrote on last edited by
                      #13

                      ok, after

                      #include <QtCharts>
                      

                      I can compile it.

                      1 Reply Last reply
                      0
                      • eyllanescE Offline
                        eyllanescE Offline
                        eyllanesc
                        wrote on last edited by
                        #14

                        add using namespace QtCharts;

                        If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved