"New Class Form" does not name a type
-
I've started to develop a new Qt v6.4.3 desktop application with Qt Creator IDE v11.2.3. I've created the window class (graphity) and, in a second time, I've created a dialog class (logswindow) with the Qt Designer Form Class of the IDE that is opened when a button is clicked. Until now it works fine. But now I need to create a new dialog windows class (updatewindow) as the first one, and when I create it in the same way and define a privare variable in the main class, the compilet returns error UpdateWindow does not name a type.
Following the graphity.h, the class is the UpdateWindow:
#ifndef GRAPHITY_H #define GRAPHITY_H #include "updatewindow.h" #include "serialconnection.h" #include "qcustomplot.h" #include "logswindow.h" #include <QMainWindow> #include <QLabel> #include <QCloseEvent> #include <QMessageBox> #include <QTime> QT_BEGIN_NAMESPACE namespace Ui { class Graphity; } QT_END_NAMESPACE #define REFRESH_PLOT_PERIOD_MS 15 #define PLOT_DATA_WIDTH_S 10 #define PLOT_LINE_WIDTH 1 struct SampleRate { SampleRate( QString name, uint16_t value ): name( name ), value( value ) { } QString name; int value; }; struct AccFullScale { AccFullScale( QString name, uint8_t value ): name( name ), value( value ) { } QString name; int value; }; struct AccDlpfBw { AccDlpfBw( QString name, uint16_t value ): name( name ), value( value ) { } QString name; int value; }; struct GyroFullScale { GyroFullScale( QString name, uint16_t value ): name( name ), value( value ) { } QString name; int value; }; struct GyroDlpfBw { GyroDlpfBw( QString name, uint16_t value ): name( name ), value( value ) { } QString name; int value; }; class Graphity : public QMainWindow { Q_OBJECT public: Graphity( QWidget *parent = nullptr ); ~Graphity(); public slots: void QuitApplication(); void UpdateSerialConnection( bool isConnected ); void FillInertialPool( QByteArray packet ); void UpdatePlotData(); void UpdateDeviceSettings( QByteArray packet ); void UpdateDeviceConnection( QByteArray packet ); void OpenLogsWindow(); void CloseLogsWindow(); // void OpenUpdateWindow(); // void CloseUpdateWindow(); signals: void SendPacket( QByteArray packet ); void SendAck(); void SendNack(); private: Ui::Graphity *ui; SerialConnection *serialConnection = nullptr; LogsWindow *logsWindow = nullptr; UpdateWindow *updateWindow = nullptr; // <--- HERE THE PROBLEM QLabel *status = nullptr; QList<SampleRate> sampleRateList; QList<AccFullScale> accFullScaleList; QList<AccDlpfBw> accDlpfBwList; QList<GyroFullScale> gyroFullScaleList; QList<GyroDlpfBw> gyroDlpfBwList; QCPGraph *accXPlot = nullptr; QCPGraph *accYPlot = nullptr; QCPGraph *accZPlot = nullptr; QCPGraph *gyroXPlot = nullptr; QCPGraph *gyroYPlot = nullptr; QCPGraph *gyroZPlot = nullptr; QCPGraph *magXPlot = nullptr; QCPGraph *magYPlot = nullptr; QCPGraph *magZPlot = nullptr; QCPAxisRect *accAxisRect = nullptr; QCPLegend *accLegend = nullptr; QCPAxisRect *gyroAxisRect = nullptr; QCPLegend *gyroLegend = nullptr; QCPAxisRect *magAxisRect = nullptr; QCPLegend *magLegend = nullptr; QCPMarginGroup *group = nullptr; QTimer *refreshPlotTimer = nullptr; QQueue<QByteArray> inertialDataQueue; bool deviceConnected; double sampleNum; double samplePeriod; double sampleTime; double samplePeriodChangedTime; double accScaleFactor; double gyroScaleFactor; void ShowStatusMessage( const QString &message ); void FillSampleRateComboBox(); void SampleRateComboBoxChanged(); void FillAccFullScaleComboBox(); void AccFullScaleComboBoxChanged(); void FillAccDlpfComboBox(); void AccDlpfComboBoxChanged(); void FillGyroFullScaleComboBox(); void GyroFullScaleComboBoxChanged(); void FillGyroDlpfComboBox(); void GyroDlpfComboBoxChanged(); void StreamButtonClicked(); void RequestDeviceSettings(); void InitPlot(); void ResetPlot(); void InitActionsConnections(); void CloseEvent( QCloseEvent *event ); }; #endif // GRAPHITY_H
the updatewindow.h :
#ifndef UPDATEWINDOW_H #define UPDATEWINDOW_H #include <QDialog> namespace Ui { class UpdateWindow; } class UpdateWindow : public QDialog { Q_OBJECT public: explicit UpdateWindow(QWidget *parent = nullptr); ~UpdateWindow(); private: Ui::UpdateWindow *ui; }; #endif // UPDATEWINDOW_H
and the updatewindow.cpp :
#include "updatewindow.h" #include "ui_updatewindow.h" UpdateWindow::UpdateWindow(QWidget *parent) : QDialog(parent), ui(new Ui::UpdateWindow) { ui->setupUi(this); } UpdateWindow::~UpdateWindow() { delete ui; }
I've done nothing but create the updatewindow class with the Qt Creator. Nothing else.
A solution to move on? -
@Andrew23 said in "New Class Form" does not name a type:
the compilet returns error "New Class" does not name a type.
I cannot spot anything wrong in the files you have shown. If the compiler spits out that
New Class
does not name a type then you must have the stringNew Class
somewhere in your code (which would be "odd" because it contains a space...).I assume you have allowed moc to run on the
.ui
file to regenerate theui_updatewindow.h
file. You might delete all intermediate files and redo the build completely from scratch to make sure everything is up to date.How about copy and pasting the actual error message emitted by the compiler?
-
@JonB the "New Class" is just a name that I used to generalize the problem. The actual compile output is
11:07:40: Running steps for project Graphity... 11:07:40: Configuration unchanged, skipping qmake step. 11:07:40: Starting: "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" -j12 C:/Qt/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Debug mingw32-make[1]: Entering directory 'D:/Documenti/Qt/Graphity/build-Graphity-Desktop_Qt_6_4_3_MinGW_64_bit-Debug' g++ -c -fno-keep-inline-dllexport -Wa,-mbig-obj -g -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQCUSTOMPLOT_USE_LIBRARY -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../Graphity -I. -IC:/Qt/6.4.3/mingw_64/include -IC:/Qt/6.4.3/mingw_64/include/QtPrintSupport -IC:/Qt/6.4.3/mingw_64/include/QtWidgets -IC:/Qt/6.4.3/mingw_64/include/QtGui -IC:/Qt/6.4.3/mingw_64/include/QtSerialPort -IC:/Qt/6.4.3/mingw_64/include/QtCore -Idebug -I. -I/include -IC:/Qt/6.4.3/mingw_64/mkspecs/win32-g++ -o debug\main.o ..\Graphity\main.cpp g++ -c -fno-keep-inline-dllexport -Wa,-mbig-obj -g -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQCUSTOMPLOT_USE_LIBRARY -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../Graphity -I. -IC:/Qt/6.4.3/mingw_64/include -IC:/Qt/6.4.3/mingw_64/include/QtPrintSupport -IC:/Qt/6.4.3/mingw_64/include/QtWidgets -IC:/Qt/6.4.3/mingw_64/include/QtGui -IC:/Qt/6.4.3/mingw_64/include/QtSerialPort -IC:/Qt/6.4.3/mingw_64/include/QtCore -Idebug -I. -I/include -IC:/Qt/6.4.3/mingw_64/mkspecs/win32-g++ -o debug\graphity.o ..\Graphity\graphity.cpp C:\Qt\6.4.3\mingw_64\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQCUSTOMPLOT_USE_LIBRARY -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN --include D:/Documenti/Qt/Graphity/build-Graphity-Desktop_Qt_6_4_3_MinGW_64_bit-Debug/debug/moc_predefs.h -IC:/Qt/6.4.3/mingw_64/mkspecs/win32-g++ -ID:/Documenti/Qt/Graphity/Graphity -IC:/Qt/6.4.3/mingw_64/include -IC:/Qt/6.4.3/mingw_64/include/QtPrintSupport -IC:/Qt/6.4.3/mingw_64/include/QtWidgets -IC:/Qt/6.4.3/mingw_64/include/QtGui -IC:/Qt/6.4.3/mingw_64/include/QtSerialPort -IC:/Qt/6.4.3/mingw_64/include/QtCore -I. -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++ -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32 -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/backward -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include-fixed -IC:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include ..\Graphity\graphity.h -o debug\moc_graphity.cpp g++ -c -fno-keep-inline-dllexport -Wa,-mbig-obj -g -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQCUSTOMPLOT_USE_LIBRARY -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../Graphity -I. -IC:/Qt/6.4.3/mingw_64/include -IC:/Qt/6.4.3/mingw_64/include/QtPrintSupport -IC:/Qt/6.4.3/mingw_64/include/QtWidgets -IC:/Qt/6.4.3/mingw_64/include/QtGui -IC:/Qt/6.4.3/mingw_64/include/QtSerialPort -IC:/Qt/6.4.3/mingw_64/include/QtCore -Idebug -I. -I/include -IC:/Qt/6.4.3/mingw_64/mkspecs/win32-g++ -o debug\moc_graphity.o debug\moc_graphity.cpp In file included from ..\Graphity\graphity.cpp:2: ..\Graphity\graphity.h:119:5: error: 'UpdateWindow' does not name a type 119 | UpdateWindow *updateWindow = nullptr; | ^~~~~~~~~~~~ In file included from ..\Graphity\main.cpp:1: ..\Graphity\graphity.h:119:5: error: 'UpdateWindow' does not name a type 119 | UpdateWindow *updateWindow = nullptr; | ^~~~~~~~~~~~ mingw32-make[1]: *** [Makefile.Debug:2384: debug/main.o] Error 1 mingw32-make[1]: *** Waiting for unfinished jobs.... mingw32-make[1]: *** [Makefile.Debug:2937: debug/graphity.o] Error 1 In file included from debug\moc_graphity.cpp:10: debug\../../Graphity/graphity.h:119:5: error: 'UpdateWindow' does not name a type 119 | UpdateWindow *updateWindow = nullptr; | ^~~~~~~~~~~~ mingw32-make[1]: Leaving directory 'D:/Documenti/Qt/Graphity/build-Graphity-Desktop_Qt_6_4_3_MinGW_64_bit-Debug' mingw32-make[1]: *** [Makefile.Debug:3229: debug/moc_graphity.o] Error 1 mingw32-make: *** [Makefile:45: debug] Error 2 11:07:51: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited with code 2. Error while building/deploying project Graphity (kit: Desktop Qt 6.4.3 MinGW 64-bit) When executing step "Make" 11:07:51: Elapsed time: 00:11.
I've cut some code parts also for synthesis, if you want check the whole project here.
-
The Error you show is completely elsewhere from what you have shown us...
-
@Christian-Ehrlicher I've shared the whole project above. I don't understand why the error if I added just the definition of the new class variable created by the IDE.
-
@Andrew23 said in "New Class Form" does not name a type:
I've shared the whole project above.
Then how come the error message tells you the error comes in file
..\Graphity\graphity.h
, which you do not show? As you can see, that file appears to referenceUpdateWindow
, in a line similar to the one you show inmainwindow.h
but not the same file? -
@JonB said in "New Class Form" does not name a type:
Then how come the error message tells you the error comes in file ..\Graphity\graphity.h, which you do not show? As you can see, that file appears to reference UpdateWindow, in a line similar to the one you show in mainwindow.h but not the same file?
Sorry but I've create confusion changing the class name in this post. Mea culpa!
I'll edit the original post with the actual code. Anyway you can check the entire project here. -
@Andrew23 have you actually run qmake(explicitly), since adding the UI-Form to the project ?
Because I cloned your project and after stripping qcustomplot from it ( Could not be bothered to manually get the library myself) it compiles just fine. (macOS Qt 6.5)
-
@JonB said in "New Class Form" does not name a type:
I assume you have allowed moc to run on the .ui file to regenerate the ui_updatewindow.h file. You might delete all intermediate files and redo the build completely from scratch to make sure everything is up to date.
-
@JonB said in "New Class Form" does not name a type:
You might delete all intermediate files and redo the build completely from scratch to make sure everything is up to date.
Can you are more specific? I'm newbie with Qt. What are intermediate files? I deleted the build directory but te error persists.
-
@J-Hilk said in "New Class Form" does not name a type:
@Andrew23 have you actually run qmake(explicitly), since adding the UI-Form to the project ?
I didn't change nothing in project settings since I started. If I remove the updatewindow UI-Form it compiles, if I add it than fails.
-
@J-Hilk said in "New Class Form" does not name a type:
run qmake and or rebuild/clean are 99% of the time fine for a "clean rebuild"
I run qmake and the output is
14:23:19: Running steps for project Graphity... 14:23:19: Starting: "C:\Qt\6.4.3\mingw_64\bin\qmake.exe" D:\Documenti\Qt\Graphity\Graphity\Graphity.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" 14:23:21: The process "C:\Qt\6.4.3\mingw_64\bin\qmake.exe" exited normally. 14:23:21: Starting: "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" -f D:/Documenti/Qt/Graphity/build-Graphity-Desktop_Qt_6_4_3_MinGW_64_bit-Debug/Makefile qmake_all mingw32-make: Nothing to be done for 'qmake_all'. 14:23:21: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited normally. 14:23:21: Elapsed time: 00:02.
Then I run rebuild and the output shows error again:
14:24:09: Running steps for project Graphity... 14:24:09: Starting: "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" clean -j12 C:/Qt/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Debug clean C:/Qt/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Release clean mingw32-make[1]: Entering directory 'D:/Documenti/Qt/Graphity/build-Graphity-Desktop_Qt_6_4_3_MinGW_64_bit-Debug' del debug\qrc_assets.cpp mingw32-make[1]: Entering directory 'D:/Documenti/Qt/Graphity/build-Graphity-Desktop_Qt_6_4_3_MinGW_64_bit-Debug' del release\qrc_assets.cpp del debug\moc_predefs.h del release\moc_predefs.h Impossibile trovare D:\Documenti\Qt\Graphity\build-Graphity-Desktop_Qt_6_4_3_MinGW_64_bit-Debug\release\qrc_assets.cpp del release\moc_graphity.cpp release\moc_logswindow.cpp release\moc_serialconnection.cpp release\moc_updatewindow.cpp del debug\moc_graphity.cpp debug\moc_logswindow.cpp debug\moc_serialconnection.cpp debug\moc_updatewindow.cpp Impossibile trovare D:\Documenti\Qt\Graphity\build-Graphity-Desktop_Qt_6_4_3_MinGW_64_bit-Debug\release\moc_predefs.h del ui_graphity.h ui_logswindow.h ui_updatewindow.h del ui_graphity.h ui_logswindow.h ui_updatewindow.h Impossibile trovare D:\Documenti\Qt\Graphity\build-Graphity-Desktop_Qt_6_4_3_MinGW_64_bit-Debug\release\moc_graphity.cpp del release\logswindow.o release\main.o release\graphity.o release\serialconnection.o release\updatewindow.o release\qrc_assets.o release\moc_graphity.o release\moc_logswindow.o release\moc_serialconnection.o release\moc_updatewindow.o del debug\logswindow.o debug\main.o debug\graphity.o debug\serialconnection.o debug\updatewindow.o debug\qrc_assets.o debug\moc_graphity.o debug\moc_logswindow.o debug\moc_serialconnection.o debug\moc_updatewindow.o mingw32-make[1]: Leaving directory 'D:/Documenti/Qt/Graphity/build-Graphity-Desktop_Qt_6_4_3_MinGW_64_bit-Debug' Impossibile trovare D:\Documenti\Qt\Graphity\build-Graphity-Desktop_Qt_6_4_3_MinGW_64_bit-Debug\release\logswindow.o mingw32-make[1]: Leaving directory 'D:/Documenti/Qt/Graphity/build-Graphity-Desktop_Qt_6_4_3_MinGW_64_bit-Debug' 14:24:10: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited normally. 14:24:10: Starting: "C:\Qt\6.4.3\mingw_64\bin\qmake.exe" D:\Documenti\Qt\Graphity\Graphity\Graphity.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" 14:24:11: The process "C:\Qt\6.4.3\mingw_64\bin\qmake.exe" exited normally. 14:24:11: Starting: "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" -f D:/Documenti/Qt/Graphity/build-Graphity-Desktop_Qt_6_4_3_MinGW_64_bit-Debug/Makefile qmake_all mingw32-make: Nothing to be done for 'qmake_all'. 14:24:11: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited normally. 14:24:11: Starting: "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" -j12 C:/Qt/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Debug mingw32-make[1]: Entering directory 'D:/Documenti/Qt/Graphity/build-Graphity-Desktop_Qt_6_4_3_MinGW_64_bit-Debug' C:\Qt\6.4.3\mingw_64\bin\uic.exe ..\Graphity\graphity.ui -o ui_graphity.h C:\Qt\6.4.3\mingw_64\bin\uic.exe ..\Graphity\logswindow.ui -o ui_logswindow.h C:\Qt\6.4.3\mingw_64\bin\uic.exe ..\Graphity\updatewindow.ui -o ui_updatewindow.h g++ -c -fno-keep-inline-dllexport -Wa,-mbig-obj -g -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQCUSTOMPLOT_USE_LIBRARY -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../Graphity -I. -IC:/Qt/6.4.3/mingw_64/include -IC:/Qt/6.4.3/mingw_64/include/QtPrintSupport -IC:/Qt/6.4.3/mingw_64/include/QtWidgets -IC:/Qt/6.4.3/mingw_64/include/QtGui -IC:/Qt/6.4.3/mingw_64/include/QtSerialPort -IC:/Qt/6.4.3/mingw_64/include/QtCore -Idebug -I. -I/include -IC:/Qt/6.4.3/mingw_64/mkspecs/win32-g++ -o debug\main.o ..\Graphity\main.cpp g++ -c -fno-keep-inline-dllexport -Wa,-mbig-obj -g -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQCUSTOMPLOT_USE_LIBRARY -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../Graphity -I. -IC:/Qt/6.4.3/mingw_64/include -IC:/Qt/6.4.3/mingw_64/include/QtPrintSupport -IC:/Qt/6.4.3/mingw_64/include/QtWidgets -IC:/Qt/6.4.3/mingw_64/include/QtGui -IC:/Qt/6.4.3/mingw_64/include/QtSerialPort -IC:/Qt/6.4.3/mingw_64/include/QtCore -Idebug -I. -I/include -IC:/Qt/6.4.3/mingw_64/mkspecs/win32-g++ -o debug\serialconnection.o ..\Graphity\serialconnection.cpp C:\Qt\6.4.3\mingw_64\bin\rcc.exe -name assets --no-zstd ..\Graphity\assets.qrc -o debug\qrc_assets.cpp g++ -fno-keep-inline-dllexport -Wa,-mbig-obj -g -std=gnu++1z -Wall -Wextra -Wextra -dM -E -o debug\moc_predefs.h C:\Qt\6.4.3\mingw_64\mkspecs\features\data\dummy.cpp C:\Qt\6.4.3\mingw_64\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQCUSTOMPLOT_USE_LIBRARY -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN --include D:/Documenti/Qt/Graphity/build-Graphity-Desktop_Qt_6_4_3_MinGW_64_bit-Debug/debug/moc_predefs.h -IC:/Qt/6.4.3/mingw_64/mkspecs/win32-g++ -ID:/Documenti/Qt/Graphity/Graphity -IC:/Qt/6.4.3/mingw_64/include -IC:/Qt/6.4.3/mingw_64/include/QtPrintSupport -IC:/Qt/6.4.3/mingw_64/include/QtWidgets -IC:/Qt/6.4.3/mingw_64/include/QtGui -IC:/Qt/6.4.3/mingw_64/include/QtSerialPort -IC:/Qt/6.4.3/mingw_64/include/QtCore -I. -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++ -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32 -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/backward -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include-fixed -IC:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include ..\Graphity\graphity.h -o debug\moc_graphity.cpp C:\Qt\6.4.3\mingw_64\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQCUSTOMPLOT_USE_LIBRARY -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN --include D:/Documenti/Qt/Graphity/build-Graphity-Desktop_Qt_6_4_3_MinGW_64_bit-Debug/debug/moc_predefs.h -IC:/Qt/6.4.3/mingw_64/mkspecs/win32-g++ -ID:/Documenti/Qt/Graphity/Graphity -IC:/Qt/6.4.3/mingw_64/include -IC:/Qt/6.4.3/mingw_64/include/QtPrintSupport -IC:/Qt/6.4.3/mingw_64/include/QtWidgets -IC:/Qt/6.4.3/mingw_64/include/QtGui -IC:/Qt/6.4.3/mingw_64/include/QtSerialPort -IC:/Qt/6.4.3/mingw_64/include/QtCore -I. -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++ -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32 -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/backward -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include-fixed -IC:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include ..\Graphity\logswindow.h -o debug\moc_logswindow.cpp C:\Qt\6.4.3\mingw_64\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQCUSTOMPLOT_USE_LIBRARY -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN --include D:/Documenti/Qt/Graphity/build-Graphity-Desktop_Qt_6_4_3_MinGW_64_bit-Debug/debug/moc_predefs.h -IC:/Qt/6.4.3/mingw_64/mkspecs/win32-g++ -ID:/Documenti/Qt/Graphity/Graphity -IC:/Qt/6.4.3/mingw_64/include -IC:/Qt/6.4.3/mingw_64/include/QtPrintSupport -IC:/Qt/6.4.3/mingw_64/include/QtWidgets -IC:/Qt/6.4.3/mingw_64/include/QtGui -IC:/Qt/6.4.3/mingw_64/include/QtSerialPort -IC:/Qt/6.4.3/mingw_64/include/QtCore -I. -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++ -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32 -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/backward -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include-fixed -IC:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include ..\Graphity\serialconnection.h -o debug\moc_serialconnection.cpp C:\Qt\6.4.3\mingw_64\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQCUSTOMPLOT_USE_LIBRARY -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN --include D:/Documenti/Qt/Graphity/build-Graphity-Desktop_Qt_6_4_3_MinGW_64_bit-Debug/debug/moc_predefs.h -IC:/Qt/6.4.3/mingw_64/mkspecs/win32-g++ -ID:/Documenti/Qt/Graphity/Graphity -IC:/Qt/6.4.3/mingw_64/include -IC:/Qt/6.4.3/mingw_64/include/QtPrintSupport -IC:/Qt/6.4.3/mingw_64/include/QtWidgets -IC:/Qt/6.4.3/mingw_64/include/QtGui -IC:/Qt/6.4.3/mingw_64/include/QtSerialPort -IC:/Qt/6.4.3/mingw_64/include/QtCore -I. -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++ -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32 -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/backward -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include-fixed -IC:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include ..\Graphity\updatewindow.h -o debug\moc_updatewindow.cpp g++ -c -fno-keep-inline-dllexport -Wa,-mbig-obj -g -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQCUSTOMPLOT_USE_LIBRARY -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../Graphity -I. -IC:/Qt/6.4.3/mingw_64/include -IC:/Qt/6.4.3/mingw_64/include/QtPrintSupport -IC:/Qt/6.4.3/mingw_64/include/QtWidgets -IC:/Qt/6.4.3/mingw_64/include/QtGui -IC:/Qt/6.4.3/mingw_64/include/QtSerialPort -IC:/Qt/6.4.3/mingw_64/include/QtCore -Idebug -I. -I/include -IC:/Qt/6.4.3/mingw_64/mkspecs/win32-g++ -o debug\updatewindow.o ..\Graphity\updatewindow.cpp g++ -c -fno-keep-inline-dllexport -Wa,-mbig-obj -g -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQCUSTOMPLOT_USE_LIBRARY -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../Graphity -I. -IC:/Qt/6.4.3/mingw_64/include -IC:/Qt/6.4.3/mingw_64/include/QtPrintSupport -IC:/Qt/6.4.3/mingw_64/include/QtWidgets -IC:/Qt/6.4.3/mingw_64/include/QtGui -IC:/Qt/6.4.3/mingw_64/include/QtSerialPort -IC:/Qt/6.4.3/mingw_64/include/QtCore -Idebug -I. -I/include -IC:/Qt/6.4.3/mingw_64/mkspecs/win32-g++ -o debug\qrc_assets.o debug\qrc_assets.cpp g++ -c -fno-keep-inline-dllexport -Wa,-mbig-obj -g -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQCUSTOMPLOT_USE_LIBRARY -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../Graphity -I. -IC:/Qt/6.4.3/mingw_64/include -IC:/Qt/6.4.3/mingw_64/include/QtPrintSupport -IC:/Qt/6.4.3/mingw_64/include/QtWidgets -IC:/Qt/6.4.3/mingw_64/include/QtGui -IC:/Qt/6.4.3/mingw_64/include/QtSerialPort -IC:/Qt/6.4.3/mingw_64/include/QtCore -Idebug -I. -I/include -IC:/Qt/6.4.3/mingw_64/mkspecs/win32-g++ -o debug\logswindow.o ..\Graphity\logswindow.cpp g++ -c -fno-keep-inline-dllexport -Wa,-mbig-obj -g -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQCUSTOMPLOT_USE_LIBRARY -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../Graphity -I. -IC:/Qt/6.4.3/mingw_64/include -IC:/Qt/6.4.3/mingw_64/include/QtPrintSupport -IC:/Qt/6.4.3/mingw_64/include/QtWidgets -IC:/Qt/6.4.3/mingw_64/include/QtGui -IC:/Qt/6.4.3/mingw_64/include/QtSerialPort -IC:/Qt/6.4.3/mingw_64/include/QtCore -Idebug -I. -I/include -IC:/Qt/6.4.3/mingw_64/mkspecs/win32-g++ -o debug\graphity.o ..\Graphity\graphity.cpp g++ -c -fno-keep-inline-dllexport -Wa,-mbig-obj -g -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQCUSTOMPLOT_USE_LIBRARY -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../Graphity -I. -IC:/Qt/6.4.3/mingw_64/include -IC:/Qt/6.4.3/mingw_64/include/QtPrintSupport -IC:/Qt/6.4.3/mingw_64/include/QtWidgets -IC:/Qt/6.4.3/mingw_64/include/QtGui -IC:/Qt/6.4.3/mingw_64/include/QtSerialPort -IC:/Qt/6.4.3/mingw_64/include/QtCore -Idebug -I. -I/include -IC:/Qt/6.4.3/mingw_64/mkspecs/win32-g++ -o debug\moc_logswindow.o debug\moc_logswindow.cpp g++ -c -fno-keep-inline-dllexport -Wa,-mbig-obj -g -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQCUSTOMPLOT_USE_LIBRARY -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../Graphity -I. -IC:/Qt/6.4.3/mingw_64/include -IC:/Qt/6.4.3/mingw_64/include/QtPrintSupport -IC:/Qt/6.4.3/mingw_64/include/QtWidgets -IC:/Qt/6.4.3/mingw_64/include/QtGui -IC:/Qt/6.4.3/mingw_64/include/QtSerialPort -IC:/Qt/6.4.3/mingw_64/include/QtCore -Idebug -I. -I/include -IC:/Qt/6.4.3/mingw_64/mkspecs/win32-g++ -o debug\moc_serialconnection.o debug\moc_serialconnection.cpp g++ -c -fno-keep-inline-dllexport -Wa,-mbig-obj -g -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQCUSTOMPLOT_USE_LIBRARY -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../Graphity -I. -IC:/Qt/6.4.3/mingw_64/include -IC:/Qt/6.4.3/mingw_64/include/QtPrintSupport -IC:/Qt/6.4.3/mingw_64/include/QtWidgets -IC:/Qt/6.4.3/mingw_64/include/QtGui -IC:/Qt/6.4.3/mingw_64/include/QtSerialPort -IC:/Qt/6.4.3/mingw_64/include/QtCore -Idebug -I. -I/include -IC:/Qt/6.4.3/mingw_64/mkspecs/win32-g++ -o debug\moc_updatewindow.o debug\moc_updatewindow.cpp g++ -c -fno-keep-inline-dllexport -Wa,-mbig-obj -g -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQCUSTOMPLOT_USE_LIBRARY -DQT_QML_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../Graphity -I. -IC:/Qt/6.4.3/mingw_64/include -IC:/Qt/6.4.3/mingw_64/include/QtPrintSupport -IC:/Qt/6.4.3/mingw_64/include/QtWidgets -IC:/Qt/6.4.3/mingw_64/include/QtGui -IC:/Qt/6.4.3/mingw_64/include/QtSerialPort -IC:/Qt/6.4.3/mingw_64/include/QtCore -Idebug -I. -I/include -IC:/Qt/6.4.3/mingw_64/mkspecs/win32-g++ -o debug\moc_graphity.o debug\moc_graphity.cpp In file included from ..\Graphity\main.cpp:1: ..\Graphity\graphity.h:119:5: error: 'UpdateWindow' does not name a type 119 | UpdateWindow *updateWindow = nullptr; | ^~~~~~~~~~~~ In file included from ..\Graphity\graphity.cpp:2: ..\Graphity\graphity.h:119:5: error: 'UpdateWindow' does not name a type 119 | UpdateWindow *updateWindow = nullptr; | ^~~~~~~~~~~~ mingw32-make[1]: *** [Makefile.Debug:2378: debug/main.o] Error 1 mingw32-make[1]: *** Waiting for unfinished jobs.... In file included from debug\moc_graphity.cpp:10: debug\../../Graphity/graphity.h:119:5: error: 'UpdateWindow' does not name a type 119 | UpdateWindow *updateWindow = nullptr; | ^~~~~~~~~~~~ mingw32-make[1]: *** [Makefile.Debug:2930: debug/graphity.o] Error 1 mingw32-make[1]: Leaving directory 'D:/Documenti/Qt/Graphity/build-Graphity-Desktop_Qt_6_4_3_MinGW_64_bit-Debug' mingw32-make[1]: *** [Makefile.Debug:3368: debug/moc_graphity.o] Error 1 mingw32-make: *** [Makefile:45: debug] Error 2 14:24:23: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited with code 2. Error while building/deploying project Graphity (kit: Desktop Qt 6.4.3 MinGW 64-bit) When executing step "Make" 14:24:23: Elapsed time: 00:14.
-
@Andrew23
In Qt Creator edit thegraphity.h
file. Go to the119 | UpdateWindow *updateWindow = nullptr;
line. Right-click on
UpdateWindow
there. Can you "Go to declaration/definition" from that symbol?This may well be a red-herring. But you are Windows, and Windows SDK has an
UpdateWindow
global function. I don't know what files Qt includes in its headers which goes into your sources, but ifwindows.h
or similar gets exported into yours it's just possible it might be picking that up. -
@JonB said in "New Class Form" does not name a type:
Right-click on UpdateWindow there. Can you "Go to declaration/definition" from that symbol?
In the right click menu there isn't "Go to declaration/definition", but if I use CTRL+Lmouse it brings me to the definition in the updatewinfow.h file. If I pass on it with mouse I get
-
@Andrew23
That's like I said then! It has indeed found the function namedUpdateWindow()
inwinuser.h
, a Windows SDK header file. And it tells you that is hiding the classUpdateWindow
you want it to pick up.You can wait for some C++ guru to suggest your best move. But one thing would work: completely delete your
UpdateWindow
class and pick some other name for it! Make sure you rebuild from scratch when you do so.Oh, for this error it tells you what you can do here:
class UpdateWindow *updateWindow = nullptr;
It even says you can click the message to make it do it for you.... I don't know if there will be other similar issues elsewhere, you will always have to use
class UpdateWindow ...
, might be simpler to rename your class.