Solved Visual Studio QT project MainForm.ui expected a declaration
-
I have a project in QT Creator and am trying to import it into Visual Studio 2019. I have solved all the issues except there is an error E0169 expected a declaration in mainwindow.ui. The problem with this error is that there is no highlighting of where the error is. I tried right clicking and compiling the mainwindow.ui file and it works and produces the ui_mainwindow.h as well as copying the compiled code directly from QT Designer into the ui_mainwindow.h...
The specific error is pointing to the mainwindow.ui. When I double click it, QTDesigner is opened so that is not helpful.(I have looked at it in XML editor and cannot see an issue) I do not understand what is going on as mainwindow.ui is just an xml file so how can the compiler have issues with it. I do not believe it is a problem with the code, I believe its a setting in VS....
Anyone else having an issue like this? Let me know if there is any settings or code that would help diagnose this.
Steps so far... Installed QT tools Imported the project Re-targeted solution to 10.xxxxx
Thanks
-
Do you try to compile the ui file? How do you create the visual studio project?
-
I found the issue.
VS did not like:
<?xml version="1.0" encoding="UTF-8"?> at the start of the file.
I removed it and it now works.
Not sure if I have a setting wrong somewhere so that line was an issue but removing it fixed it.
Thanks,
--James