Getting Started Qt Data Visualization Visual Studio 2015



  • Hi Guys,

    i really need some Help getting started with QT and Qtdatavizualization.

    I followed the QT Documentation but always get a lot of Error :/ Maybe you could help me .

    What i want to do :
    Creating a 3d Koordinatesystem with Points in it.

    What i have done so far :

    1. I installed the QT Offline Version (with QTDatavisualization)
    2. Installed the QT Plugin in Vsual Studio
    3. Added the QT version to VIsual Studio.
    4. I created a QT Project with Visual Studio
    5. I created the .pro File with the QT Plug in.
    # ----------------------------------------------------
    # This file is generated by the Qt Visual Studio Add-in.
    # ------------------------------------------------------
    
    TEMPLATE = app
    TARGET = HelloWorld
    DESTDIR = ../Win32/Debug
    QT += core widgets gui
    CONFIG += debug
    DEFINES += QT_DLL QT_WIDGETS_LIB
    INCLUDEPATH += ./GeneratedFiles \
        . \
        ./GeneratedFiles/Debug
    DEPENDPATH += .
    MOC_DIR += ./GeneratedFiles/debug
    OBJECTS_DIR += debug
    UI_DIR += ./GeneratedFiles
    RCC_DIR += ./GeneratedFiles
    include(HelloWorld.pri)
    
    SOURCES += helloworld.cpp
    SOURCES += main.cpp
    HEADERS += helloworld.h
    QT += datavisualization
    
    1. Then i started qmake -o Makefile HelloWorld.pro in the Command Prompt of Visual Studio and get my First Error !
      see picture https://s30.postimg.org/48uso8vdt/Command_Prompt_error.png

    2. the only things i changed in my code are:
      Adding :
      #include <QtDataVisualization\qtdatavisualizationversion.h>
      #include <QtDataVisualization\q3dbars.h>

    using namespace QtDataVisualization;

    and

    Adding : QT += datavisualization to the .pro File
    and

    Q3DBars *graph = new Q3DBars();

    These are the Errors i get...
    https://s27.postimg.org/ed3s2z843/Errors_in_Visual_studio.png

    I hope that sb can help me pls :(



  • Hi @BadHombre ,

    Do you already have created some apps with Qt and Visual Studio? Or it is your first?

    Did add the library to your MSVC project?

    I'm little bit confused, because when i created apps with MSVC i didn't need to create a .pro file.



    1. Yes i have created some little Gui Apps with Qt

    2. Yes i added the Qtdatavisulization Lib to MSVC... Project properties -> Added the include Directorie of QTDatavisualization and the Library Directory

    3. I never used the .pro File in MSVC ... but in the QT documentation they mentioned to add QT += datavisualization to the .pro File ... so i thought maybe i have to create a .pro FIle



  • @BadHombre
    Okay,
    i think you miss to add the library to the additional dependencies for the linker.

    The compiler have to know where the classes, functions, etc. are defined. In your case it's defined in the Qt5DataVisulizationd.lib / Qt5DataVisulization.lib, so you have to add them to your project. In general you can add the libraries with the vs plugin (like network, sql, etc.. ) but the data visualization module is really new and you're not able to add it with the vs plug-in.

    You have to add it manually. Have a look at the project properties, linker, input, additional dependencies (or something similiar). There you have to add QtDataVisualizationd.lib or QtDataVisualization.lib depending on your build environment (debug / release).



  • @beecksche Thanks for your answer ! i added QtDataVisualization.lib to additional dependencies. Now i get less Errors.

    There is only one Error :

    Link1104 Cannot open file 'QtDataVisualization.lib'

    Any Idea ?



  • @BadHombre
    Yeah i'm not quite sure if i have wrote it correctly. The best way is, that you look in the Qt directory, where all the libraries are installed. There you should see your necessary file.



  • @beecksche oh sry my fault... the name of the the file is Qt5DataVisualization.lib.. i added the File.. and now i get again a lot of Link Errors :/ see picture

    http://up.picr.de/27972606pb.jpg
    http://up.picr.de/27972607gv.jpg
    http://up.picr.de/27972608em.jpg
    http://up.picr.de/27972609uo.jpg



  • @BadHombre
    so you have to add the libraries also. In that case you can do it with the vs plug in.
    Open your VS Plugin in and check the needed modules. I think it only should be GUI.



  • @beecksche sorry but what do you mean with Vs Plug in ? the Qt Plug in in Vs ? And if yes how do i check the modules ?
    sorry for the supid questions.



  • @beecksche now i added all libraries to the Project... and i have two errors left :

    1. Error LNK1120 1unresolved externals File : HelloWorld.exe
      2.Error LNK2019 unresolved external symbol WinMain referenced in function ''int_cdecl invoke_main(void)''(? invoke_main@@YAHXZ)


  • @BadHombre
    Questions are never stupid. I think my explanations are bad!

    You said, that you have installed the "QT Plugin in Vsual Studio". Am i right that you mean the Qt VS Add In http://doc.qt.io/qtvstools/index.html ?

    In your Solution Explorer in Visual Studio right click on your project and select Qt Project Settings. Go to the tab: Qt Modules.
    There you can add/remove the needed Qt modules.

    I think in your case an easier way to learn Qt Datavisualization is to work the examples (if you have installed them). You find them in the Qt directory.

    To convert the examples for Visual Studio you can do this:

    1. Open the visual studio developer command prompt
    2. Go to the Qt directory an call the qtenv2.bat
    3. Go to the examples directory
    4. Call qmake -tp vc
    5. Call devenv xx.vcxproj

    An example

    C:\>Qt\Qt5.7.0_MSVC2013\5.7\msvc2013\bin\qtenv2.bat
    C:\Qt\Qt5.7.0_MSVC2013\Examples\Qt-5.7\datavisualization\bars>
    C:\Qt\Qt5.7.0_MSVC2013\Examples\Qt-5.7\datavisualization\bars>qmake -tp vc
    C:\Qt\Qt5.7.0_MSVC2013\Examples\Qt-5.7\datavisualization\bars>devenv bars.vcxproj
    
    
    


  • @beecksche Thanks for your Help.

    I checked the modules and all are active.

    I also convert the Example for Visual Studio and it works perfectly.

    So what i will do now is .. i take the example and change it to my Project :D

    Again Thanks @beecksche for your good Help !


Log in to reply
 

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