Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to use KDCharts from GitHub on Windows?
Forum Updated to NodeBB v4.3 + New Features

How to use KDCharts from GitHub on Windows?

Scheduled Pinned Locked Moved Solved General and Desktop
25 Posts 4 Posters 3.4k 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.
  • VRoninV VRonin

    @Mucip said in How to use KDCharts from GitHub on Windows?:

    I think it's because of VS2019 or my path variables?!

    Did you run vcvarsall.bat x64 as mentioned in step 4? and I don't mean double-clicking on the file but using the command line to execute them

    MucipM Offline
    MucipM Offline
    Mucip
    wrote on last edited by
    #21

    @VRonin ,
    I run below command in MSVC2019 console:

    C:\Users\mucip\Documents\Qt\KDChart\build>"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
    

    It's building now. I think it will be ok. Thanks :)

    Regards,
    Mucip:)

    1 Reply Last reply
    0
    • VRoninV VRonin
      1. Install MSVC (aka Visual Studio)
      2. Install Qt5 for MSVC
      3. Install CMake (https://cmake.org/)
      4. open a command prompt and run both qtenv2.bat (from the Qt folder) and vcvarsall.bat x64 (from the Visual Studio Folder)
      5. Prepend the path to cmake.exe to your PATH env variable: SET PATH=C:\Program Files\CMake;%PATH%
      6. download the sources of kdchart
      7. navigate the command prompt to that folder
      8. Run the following commands:
      mkdir build
      cd build
      cmake -G "NMake Makefiles" -DCMAKE_DEBUG_POSTFIX=d -DCMAKE_INSTALL_PREFIX=C:/KDCharts -DCMAKE_BUILD_TYPE=DEBUG ../
      cmake --build .
      cmake --build . --target install
      cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=C:/KDCharts -DCMAKE_BUILD_TYPE=RELEASE ../
      cmake --build .
      cmake --build . --target install
      
      MucipM Offline
      MucipM Offline
      Mucip
      wrote on last edited by
      #22

      @VRonin ,
      I build library and add all necessary things in pro file:

      QT       += core gui
      
      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
      
      CONFIG += c++11
      
      # The following define makes your compiler emit warnings if you use
      # any Qt feature that has been marked deprecated (the exact warnings
      # depend on your compiler). Please consult the documentation of the
      # deprecated API in order to know how to port your code away from it.
      DEFINES += QT_DEPRECATED_WARNINGS
      
      # You can also make your code fail to compile if it uses deprecated APIs.
      # In order to do so, uncomment the following line.
      # You can also select to disable deprecated APIs only up to a certain version of Qt.
      #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
      
      SOURCES += \
          main.cpp \
          mainwindow.cpp
      
      HEADERS += \
          mainwindow.h
      
      FORMS += \
          mainwindow.ui
      
      # Default rules for deployment.
      qnx: target.path = /tmp/$${TARGET}/bin
      else: unix:!android: target.path = /opt/$${TARGET}/bin
      !isEmpty(target.path): INSTALLS += target
      
      win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../KDCharts/lib/ -lkdchart2
      else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../KDCharts/lib/ -lkdchart2d
      # else:unix:!macx: LIBS += -L$$PWD/../KDCharts/lib/ -lkdchart2
      
      
      
      
      
      INCLUDEPATH += $$PWD/../KDCharts/include/KDChart
      DEPENDPATH += $$PWD/../KDCharts/include/KDChart
      

      I can add the includes without erro in mainWindow.h file

      #include <KDChartChart>
      #include <KDChartLineDiagram>
      
      

      Then in cpp file:

      //Add the widget to your layout like any other QWidget:
          QHBoxLayout* chartLayout = new QHBoxLayout(ui->chartFrame);
          KDChart::Chart *m_chart = new KDChart::Chart(this);
          chartLayout->addWidget( m_chart );
      

      But I can not run the code. It crush without message. Only this:

      22:40:54: Starting C:\Users\mucip\Documents\Qt\build-KDChartdYeniDeneme-Desktop_Qt_5_13_2_MSVC2017_64bit-Release\release\KDChartdYeniDeneme.exe ...
      22:40:54: The program has unexpectedly finished.
      22:40:54: The process was ended forcefully.
      22:40:54: C:\Users\mucip\Documents\Qt\build-KDChartdYeniDeneme-Desktop_Qt_5_13_2_MSVC2017_64bit-Release\release\KDChartdYeniDeneme.exe crashed.
      

      I run debugger but nothings happend?! I use MSVC2019. May it be because of newest version of VS?

      Regards,
      Mucip:)

      MucipM VRoninV 2 Replies Last reply
      0
      • MucipM Mucip

        @VRonin ,
        I build library and add all necessary things in pro file:

        QT       += core gui
        
        greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
        
        CONFIG += c++11
        
        # The following define makes your compiler emit warnings if you use
        # any Qt feature that has been marked deprecated (the exact warnings
        # depend on your compiler). Please consult the documentation of the
        # deprecated API in order to know how to port your code away from it.
        DEFINES += QT_DEPRECATED_WARNINGS
        
        # You can also make your code fail to compile if it uses deprecated APIs.
        # In order to do so, uncomment the following line.
        # You can also select to disable deprecated APIs only up to a certain version of Qt.
        #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
        
        SOURCES += \
            main.cpp \
            mainwindow.cpp
        
        HEADERS += \
            mainwindow.h
        
        FORMS += \
            mainwindow.ui
        
        # Default rules for deployment.
        qnx: target.path = /tmp/$${TARGET}/bin
        else: unix:!android: target.path = /opt/$${TARGET}/bin
        !isEmpty(target.path): INSTALLS += target
        
        win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../KDCharts/lib/ -lkdchart2
        else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../KDCharts/lib/ -lkdchart2d
        # else:unix:!macx: LIBS += -L$$PWD/../KDCharts/lib/ -lkdchart2
        
        
        
        
        
        INCLUDEPATH += $$PWD/../KDCharts/include/KDChart
        DEPENDPATH += $$PWD/../KDCharts/include/KDChart
        

        I can add the includes without erro in mainWindow.h file

        #include <KDChartChart>
        #include <KDChartLineDiagram>
        
        

        Then in cpp file:

        //Add the widget to your layout like any other QWidget:
            QHBoxLayout* chartLayout = new QHBoxLayout(ui->chartFrame);
            KDChart::Chart *m_chart = new KDChart::Chart(this);
            chartLayout->addWidget( m_chart );
        

        But I can not run the code. It crush without message. Only this:

        22:40:54: Starting C:\Users\mucip\Documents\Qt\build-KDChartdYeniDeneme-Desktop_Qt_5_13_2_MSVC2017_64bit-Release\release\KDChartdYeniDeneme.exe ...
        22:40:54: The program has unexpectedly finished.
        22:40:54: The process was ended forcefully.
        22:40:54: C:\Users\mucip\Documents\Qt\build-KDChartdYeniDeneme-Desktop_Qt_5_13_2_MSVC2017_64bit-Release\release\KDChartdYeniDeneme.exe crashed.
        

        I run debugger but nothings happend?! I use MSVC2019. May it be because of newest version of VS?

        Regards,
        Mucip:)

        MucipM Offline
        MucipM Offline
        Mucip
        wrote on last edited by
        #23

        Hi,
        Missing DLL's. Sorry...
        I coppied DLL's from KDCharts/bin directory to build directory.

        Regards,
        Mucip:)

        1 Reply Last reply
        0
        • MucipM Mucip

          @VRonin ,
          I build library and add all necessary things in pro file:

          QT       += core gui
          
          greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
          
          CONFIG += c++11
          
          # The following define makes your compiler emit warnings if you use
          # any Qt feature that has been marked deprecated (the exact warnings
          # depend on your compiler). Please consult the documentation of the
          # deprecated API in order to know how to port your code away from it.
          DEFINES += QT_DEPRECATED_WARNINGS
          
          # You can also make your code fail to compile if it uses deprecated APIs.
          # In order to do so, uncomment the following line.
          # You can also select to disable deprecated APIs only up to a certain version of Qt.
          #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
          
          SOURCES += \
              main.cpp \
              mainwindow.cpp
          
          HEADERS += \
              mainwindow.h
          
          FORMS += \
              mainwindow.ui
          
          # Default rules for deployment.
          qnx: target.path = /tmp/$${TARGET}/bin
          else: unix:!android: target.path = /opt/$${TARGET}/bin
          !isEmpty(target.path): INSTALLS += target
          
          win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../KDCharts/lib/ -lkdchart2
          else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../KDCharts/lib/ -lkdchart2d
          # else:unix:!macx: LIBS += -L$$PWD/../KDCharts/lib/ -lkdchart2
          
          
          
          
          
          INCLUDEPATH += $$PWD/../KDCharts/include/KDChart
          DEPENDPATH += $$PWD/../KDCharts/include/KDChart
          

          I can add the includes without erro in mainWindow.h file

          #include <KDChartChart>
          #include <KDChartLineDiagram>
          
          

          Then in cpp file:

          //Add the widget to your layout like any other QWidget:
              QHBoxLayout* chartLayout = new QHBoxLayout(ui->chartFrame);
              KDChart::Chart *m_chart = new KDChart::Chart(this);
              chartLayout->addWidget( m_chart );
          

          But I can not run the code. It crush without message. Only this:

          22:40:54: Starting C:\Users\mucip\Documents\Qt\build-KDChartdYeniDeneme-Desktop_Qt_5_13_2_MSVC2017_64bit-Release\release\KDChartdYeniDeneme.exe ...
          22:40:54: The program has unexpectedly finished.
          22:40:54: The process was ended forcefully.
          22:40:54: C:\Users\mucip\Documents\Qt\build-KDChartdYeniDeneme-Desktop_Qt_5_13_2_MSVC2017_64bit-Release\release\KDChartdYeniDeneme.exe crashed.
          

          I run debugger but nothings happend?! I use MSVC2019. May it be because of newest version of VS?

          Regards,
          Mucip:)

          VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #24

          @Mucip said in How to use KDCharts from GitHub on Windows?:

          -L$$PWD/../KDCharts/lib/

          Relative paths are often inadvisable, use the full absolute path -LC:/KDCharts/lib/

          I coppied DLL's from KDCharts/bin directory to build directory.

          This is bad. You should add the path to those DLLs to the "run environment" options of Qt Creator

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          MucipM 1 Reply Last reply
          4
          • VRoninV VRonin

            @Mucip said in How to use KDCharts from GitHub on Windows?:

            -L$$PWD/../KDCharts/lib/

            Relative paths are often inadvisable, use the full absolute path -LC:/KDCharts/lib/

            I coppied DLL's from KDCharts/bin directory to build directory.

            This is bad. You should add the path to those DLLs to the "run environment" options of Qt Creator

            MucipM Offline
            MucipM Offline
            Mucip
            wrote on last edited by
            #25

            Hi @VRonin ,
            OK. I will care about this advice. Thanks. ;)

            Regards,
            Mucip:)

            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