** MY SOLUTION **
I had this same issue with my QT Widgets project using Windows 11 host machine. I had upgraded my QT to 6.8.3 and this Error: undefined reference to `qMain(int, char)'** even though this wasn't the actual issue . Following my steps below, Qt Creator was able to highlight the actual issues for me to resolve and successfully build my project.
Steps to Resolve the Issue:
Create a new, most simple Qt Widgets project. Use the default mainwindow.h, mainwindow.cpp and mainwindow.ui
with the project kit that you want to use
Run CMake
Build the project. It should build successfully
Open the CMakeLists.txt file
Utilize this new, simple CMakeLists.txt file as a template for your ORIGINAL project.
Modify the "template" CMakeLists.txt file to include your original project's resource file names where you see main.cpp, mainwindow.h, mainwindow.cpp, etc.
Modify the "template" CMakeLists.txt file to include the QT packages you are using (Core, Gui, or etc.)
Modify the "template" CMakeLists.txt file to include the target link libraries (refer to packages in previous step)
Build your original project
It should give you more specific, helpful errors to resolve (if there are any). For me, one of my *.cpp files #include Qt Serial Bus but I forgot to add it to CMakeLists.txt
Resolve errors
Rebuild. It built successfully for me.