Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Integrating Qt class in existing project of VS2019



  • Hello everyone.

    I have recently started with the Qt framework and decided to test an existing project in C++ with Visual Studio.

    I did the installation of the Qt plugin for visual studio without problems.

    The project is about a game that i want to add a simply function. Contains multiples proyects in the same solution.

    The steps I followed were the following:

    1. I created a new project within the solution using the Qt wizard called (QtApplication1) and then I converted it into a static library. (I added the Qt bin and include directories in propeties of proyect)

    2. In one of the projects of the solution there is one called Zone, I want to add the function (specifically in the file LuaPlot.h & LuaPlot.cpp).

    Previosly, in Zone proyect I added the reference to the static library that I created with Qt (QtApplication1).

    1. Inside LuaPlot.h (Zone proyect) i add include file of my QtApplication1 project (Nane.h).
      Receiving the following errors:

    alt text

    Severity	Code	Description	Project	File	Line	Suppression State
    Error (active)	E0018	expected a ')'	Zone	C:\Qt\5.15.2\msvc2019_64\include\QtCore\qobjectdefs.h	344	
    Severity	Code	Description	Project	File	Line	Suppression State
    Error (active)	E0065	expected a ';'	Zone	C:\Qt\5.15.2\msvc2019_64\include\QtCore\qobjectdefs.h	344	
    Severity	Code	Description	Project	File	Line	Suppression State
    Error (active)	E0757	function "QMetaObject::QObject" is not a type name	Zone	C:\Qt\5.15.2\msvc2019_64\include\QtCore\qobjectdefs.h	345	
    Severity	Code	Description	Project	File	Line	Suppression State
    Error (active)	E0018	expected a ')'	Zone	C:\Qt\5.15.2\msvc2019_64\include\QtCore\qobjectdefs.h	345	
    Severity	Code	Description	Project	File	Line	Suppression State
    Error (active)	E0065	expected a ';'	Zone	C:\Qt\5.15.2\msvc2019_64\include\QtCore\qobjectdefs.h	345	
    Severity	Code	Description	Project	File	Line	Suppression State
    Error (active)	E0757	function "QMetaObject::QObject" is not a type name	Zone	C:\Qt\5.15.2\msvc2019_64\include\QtCore\qobjectdefs.h	384	
    
    

    LuaPlot.h

    https://pastebin.com/xEqVPBdP

    LuaPlot.cpp

    https://pastebin.com/MwejSdar

    Nane.h

    https://pastebin.com/5iiFAGqL

    Nane.cpp

    https://pastebin.com/gwNHrxBe

    The error happens when i put include of my Qt header (Nane.h) in LuaPlot.h

    I would appreciate if someone can explain something to me about this error. If there is something that is not understood or I have not explained well, tell me.

    Thanks and regards.


Log in to reply