Can confirm the checked answer by OP. From the "Debug" button in lower left corner of the editor, select the compiler from the list. For me it was originally "Desktop (x86-windows-msys-pe-64bit" when it threw the error. I selected "Desktop Qt 6.8.1 MinGW 64 bit" and the code compiled and ran successfully.