PDA

View Full Version : ui. files with Visual Studio 10



ich
21st August 2014, 13:58
Hi,
I only added a label in a complete C++/Qt Project with the Qt-Desinger, then I tried to rebuild the project with Visual Studio, but now I get some errors like this : "error C4430: missing type specifier - int assumed. Note: C++ does not support default-int", meaning that the compiler couldn't find my ui.-file ? I tried to remove the changes, but the result was the same... :/ Maybe you can help me ? :)
Thanks a lot !

ich
22nd August 2014, 13:16
Hi, I've got a complete Qt-Projekt, including some .ui-files and it worked with Visual Studio. Then I wanted to change some Labels etc. in the ui.-files, but now the Visual Studio add-on only creates empty .cpp and .h-files... :confused:
And I get nearly 263 Erros caused of this...The first error is: 324 IntelliSense: identifier "Dialog" is undefined m:\... 2382
The ui-files were first written with Qt 3 and now transfomed to Qt 4. I changed the Labels with the Desinger an Qt 4.7.4 Version. So I used the uic3.exe and also tried the uic.exe, but it doesn't work ...
:(
Have you any idea ?
Thanks a lot for help !

d_stranz
22nd August 2014, 17:14
How can we help you if all you tell us is that you made some changes to a project and now get a lot of errors when you try to build it?


Could you build the project before you made the changes?

If you create a completely new project with a ui file (maybe a dialog-based app), do you get the same problems?

Did you install the Qt Visual Studio plugin? Is it the correct one for Visual Studio 2010?

Do you have more than one version of Qt installed? If so, are you sure you are compiling against the one you think you are?

ich
25th August 2014, 09:20
I could compile the project and everything runed...I've got the Qt plug-in for Visual Studio 10 and it creates .h and .cpp-files to the .ui-files in the build folder, but after I changed one file it only creats an empty .cpp and .h- files for it...
How does the plug-in exactly work ? o.O

ChrisW67
25th August 2014, 13:47
I assume the plugin simply arranges to run the [B]uic[B] command over the *.ui files in your project, adding the resulting source files to the project (just like qmake does for the rest of us). If you are getting empty *.cpp/*.h files then my guess (and it is only a guess) is that you have broken the *.ui file.

Is the *.ui file zero sized? Valid XML? What do you get when you run uic over the *.ui file? C++ code like this:


$ uic test.ui
/************************************************** ******************************
** Form generated from reading UI file 'test.ui'
**
...
QT_END_NAMESPACE

#endif // UI_TEST_H

or something like this:


$ uic test.ui
uic: Error in line 1, column 0 : Premature end of document.
File 'fuck.ui' is not valid

d_stranz
25th August 2014, 20:04
The Visual Studio Qt plugin manages the project file (VS version of a Makefile), provides some wizards for adding new Qt-based classes to projects, can import and export .pro files, adds build and link rules to run uic and moc when needed, and so forth. For ui files, opening them for edit will run Qt Designer by default. It would be nearly impossible to use Visual Studio productively on Qt projects without it.

It sounds to me like the OP has broken the UI file. I'm not sure how that is possible if the only changes that were made were done through Qt Designer unless something happened when saving the file to cause corruption.

It is also possible that if a new widget was added to the .ui file, the appropriate #include files might not have been added to the C++ class source files. This doesn't happen automatically. A "C++ does not support default int" error usually arises when the return type for a method or an argument type for a method has not been specified (or can't be determined from the types in scope during the compilation).

I'd suggest deleting the .ui file and using Qt Designer in stand-alone mode to re-create a new file with the same name as the old one. If the old file can still be opened in Qt Designer, then rename it, open it, create a new widget / dialog, and drag and drop the old widgets and layouts into the new one.

ich
2nd September 2014, 11:57
It's simply empty.. o.O There are no hinds on some errors ... :/

ich
9th September 2014, 13:02
...I've got still problems with this project... It is written in Qt 3 with Visual Studio 10 and "transformed" to Qt 4 with the uic3.exe, that means I've got a .ui-file, Qt-Version 3.3, that I can open and edit with the Qt4-Designer, but I can't compile the edited version. The uic3.exe builds a Qt4 compatible .h and .cpp-file, including the informations from the .ui and ui.h-file. What I want is to transforme the .ui and ui.h in that way, that I can edit the .ui file with the Qt 4-Designer.
I tried to write my own .h and .cpp within the Slots and Signal for one of the, with the QtDesigner tranformed, .ui-files. I tried Project->addClass->Qt4GuiClass but I got the error: "It is impossible to add a QtGuiClass to the current project, as it was not created using Qt4VSAddin." Then I tried "Convert project to Qt add-in project" but I got still the same error.
I also tried to add the .ui/.h/.cpp-files from a VisualStudio written, working test-project and to include them in my project, but I my tries had no success, in that way, that Visual Studio doesn't create the ui_myTest.h or the moc_...-file or somethÃ*ng else additional..
Have you any idea how I can modify the settings or what I have to add ?