ahhh yes, thankyou
to avoid confusion, i actually wanted the code to read:
Qt Code:
{ Q_OBJECT public:To copy to clipboard, switch view to plain text mode
ahhh yes, thankyou
to avoid confusion, i actually wanted the code to read:
Qt Code:
{ Q_OBJECT public:To copy to clipboard, switch view to plain text mode
Fine, but still, delete the "::", they do not belong to that place.
i am now getting these errors for the new code
src/mainScreen.h:12: error: expected class-name before ‘{’ token
src/mainScreen.h:12: error: invalid use of incomplete type ‘struct QDialog’
Qt Code:
#ifndef __MAIN_H__ #define __MAIN_H__ #include <QMainWindow> #include <QApplication> #include <QPushButton> #include <cstdlib> #include "ui_menuScreen.h" // connects the code to the UI { Q_OBJECT public: }; #endifTo copy to clipboard, switch view to plain text mode
Qt Code:
#ifndef __MAIN_H__ #define __MAIN_H__ #include <QMainWindow> #include <QApplication> #include <QPushButton> #include <cstdlib> #include "ui_menuScreen.h" // connects the code to the UI { Q_OBJECT public: }; #endifTo copy to clipboard, switch view to plain text mode
Line 7 seems to include the wrong file, which is probably why Ui::mainScreenDLG is unknown.
no, Ui::mainScreenDLG must be in ui_menuScreen.h, look for it.
in fact mainScreenDLG must be the name of the widget class u created in designer.
if mainScreenDLG is not the name of that class replace it with class name
the object name is "mainScreenDLG" in the file mainScreen.ui (created in Qt Designer)
i think that it hadnt recognised the mainScreen.ui file until i re-opened it in Designer for some reason. that or i had misnamed it and
but im still getting the "13: error: expected class-name before ‘{’ token"
on a related note, the code from my "mainScreen.cpp" file is experiencing errors
Qt Code:
#include <QApplication> #include <QDataStream> #include <QtGui> #include <cstdlib> #include <ctime> #include "ui_mainScreen.h" #include "mainScreen.h" bool selectSum, selectSub, selectMulti, selectDivisi; // code to begin the programme { setupUi(this); // connect the buttons and labels to the code connect (btnCheck, SIGNAL( clicked() ), this, SLOT( getPath() ) ); };To copy to clipboard, switch view to plain text mode
18: error: no matching function for call to ‘mainScreen::connect(<unresolved overloaded function type>, const char*, mainScreen* const, const char*)’
thankyou for everyone in their help!
EDIT: the new error was because i had tried to link by button to a function that did not exist (getPath)
Last edited by Baxter; 27th July 2010 at 12:19.
Greenscape, you seem to be confusing me with the author of the broken program.
Qmake will generate uic commands for the .ui file "mainScreen.ui" to generate a file "ui_mainScreen.h" that contains the definitions for the objects in the design. Your code defining "class mathsGame" (first post) includes a file called "ui_menuScreen.h", which presumably relates to a different Designer form that does not define mainScreenDLG.Originally Posted by Baxter
Probably because it does not know of an object by the name btnCheck which the error reports as "<unresolved overloaded function type>".on a related note, the code from my "mainScreen.cpp" file is experiencing errors
Baxter
u try to change class name:mainScreen to myMainScreen or rename other
mainScreen,MainScreen may be retained by QT Create
read carefully:
only constructors and destructors has no return type, you just need to add void (or other return type) before mainScreenDLG:declaration of ‘mainScreenDLG’ with no type
Qt Code:
To copy to clipboard, switch view to plain text mode
they do! they tell to compiler namespace where QDialog declared. in this case the do nothing beacuse QDialog in global scope.Fine, but still, delete the "::", they do not belong to that place.
Last edited by GreenScape; 27th July 2010 at 08:36.
i have been using this tutorial to help me
http://sector.ynet.sk/qt4-tutorial/m...plication.html
the "myqtapp.h" file is what is being referred to by me
download QtCreator and be happy!
Bookmarks