problem in qt for beginner
Dear my friends... I tried to develop an application with qt. As the beginning I try to make a very simple application with qt. just display a form contain a label "Hello Qt". But I have problem in compiling as below: patrixlinux@patrix:~/arsip/proyek/metric> ls conversionform.ui main.cpp metric.pro patrixlinux@patrix:~/arsip/proyek/metric> qmake -o Makefile metric.pro patrixlinux@patrix:~/arsip/proyek/metric> ls Makefile conversionform.ui main.cpp metric.pro patrixlinux@patrix:~/arsip/proyek/metric> make g++ -c -pipe -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -fPIC -Wall -W -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -fPIC -DQT_NO_DEBUG -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/lib/qt3/mkspecs/default -I. -I/usr/include -I/usr/lib/qt3/include -I.ui/ -I. -I.moc/ -o .obj/main.o main.cpp main.cpp:2:22: unnamed1.h: No such file or directory main.cpp: In function `int main(int, char**)': main.cpp:7: error: `conversionForm' undeclared (first use this function) main.cpp:7: error: (Each undeclared identifier is reported only once for each function it appears in.) main.cpp:7: error: syntax error before `;' token main.cpp:8: error: `w' undeclared (first use this function) make: *** [.obj/main.o] Error 1 patrixlinux@patrix:~/arsip/proyek/metric> My program only contents 1 form (conversionForm) with 1 textLabel. too poor that I have not understood where I should define the init (of constructor) and destroy (of destructor). In project view, I found "conversionform.ui.h" and thist texts as below : " /**************************************************************************** ** ui.h extension file, included from the uic-generated form implementation. ** ** If you wish to add, delete or rename functions or slots use ** Qt Designer which will update this file, preserving your code. Create an ** init() function in place of a constructor, and a destroy() function in ** place of a destructor. *****************************************************************************/ " I tried to see the help of qt but I didn't find a brief explanation about where I can make init() from qt designer. Please help me, teach me please..... I am an idiot computer freak but I strong willing to learn. Thank you very much for your generousity. __________________________________ Do you Yahoo!? SBC Yahoo! - Internet access at a great low price. http://promo.yahoo.com/sbc/
main.cpp:2:22: unnamed1.h: No such file or directory
Your main.cpp wants a header file called unnamed1.h, which it's not finding. Did you tell it to include that? Post your main.cpp file. Alternatively, join the Qt interest mailing list (via the Trolltech website). It's quite busy and very friendly. --
eatapple core dump
Thanks for your respond, Derek.. Here is my main.cpp as below: patrixlinux@patrix:~/arsip/proyek/metric> cat main.cpp #include <qapplication.h> #include "unnamed1.h" int main( int argc, char ** argv ) { QApplication a( argc, argv ); conversionForm w; w.show(); a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) ); return a.exec(); } patrixlinux@patrix:~/arsip/proyek/metric> I don't understand what the '#include "unnamed1.h"' means... I don't have that file in my code. I tried to comment that line with "//" but the same problem still exists. I even have not made the "conversionform.ui.h" because I don't want to make a further program yet. I want to try first to display a form containing textLabel "Hallo Qt". I joined the mailing list but no respond for my question. that's why I prefer suse-programming-e as I also know (heard) that SuSE guys use Qt to develop our beloved SuSE. Thanks for your help, Derek. --- Derek Fountain <derekfountain@yahoo.co.uk> wrote:
main.cpp:2:22: unnamed1.h: No such file or directory
Your main.cpp wants a header file called unnamed1.h, which it's not finding. Did you tell it to include that? Post your main.cpp file.
Alternatively, join the Qt interest mailing list (via the Trolltech website). It's quite busy and very friendly.
--
eatapple core dump
-- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e
__________________________________ Do you Yahoo!? SBC Yahoo! - Internet access at a great low price. http://promo.yahoo.com/sbc/
What happened, most likely, is that you used QT Designer to create the main.cpp file before you saved and named your conversionForm widget. If you replace the #include "unnamed1.h" with #include "FormFileName.h" (where FormFileName is the name you saved your form as with .h for an extension instead of .ui), then it should work. You may also want to first want to improve your general C++ skills a little before jumping into QT. QT is a great toolkit to use for GUI programming using C++, but a good understanding of C++ makes it a lot easier. Look for some C++ resources on google, or get a good book from the library, and most of all, keep trying and asking questions. Good luck, Preston Prabu Subroto wrote:
Thanks for your respond, Derek..
Here is my main.cpp as below:
patrixlinux@patrix:~/arsip/proyek/metric> cat main.cpp #include <qapplication.h> #include "unnamed1.h"
int main( int argc, char ** argv ) { QApplication a( argc, argv ); conversionForm w; w.show(); a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) ); return a.exec(); } patrixlinux@patrix:~/arsip/proyek/metric>
I don't understand what the '#include "unnamed1.h"' means... I don't have that file in my code. I tried to comment that line with "//" but the same problem still exists. I even have not made the "conversionform.ui.h" because I don't want to make a further program yet. I want to try first to display a form containing textLabel "Hallo Qt".
I joined the mailing list but no respond for my question. that's why I prefer suse-programming-e as I also know (heard) that SuSE guys use Qt to develop our beloved SuSE.
Thanks for your help, Derek. --- Derek Fountain <derekfountain@yahoo.co.uk> wrote:
main.cpp:2:22: unnamed1.h: No such file or
directory
Your main.cpp wants a header file called unnamed1.h, which it's not finding. Did you tell it to include that? Post your main.cpp file.
Alternatively, join the Qt interest mailing list (via the Trolltech website). It's quite busy and very friendly.
--
eatapple
core dump
-- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e
__________________________________ Do you Yahoo!? SBC Yahoo! - Internet access at a great low price. http://promo.yahoo.com/sbc/
You may also want to first want to improve your general C++ skills a little before jumping into QT. QT is a great toolkit to use for GUI programming using C++, but a good understanding of C++ makes it a lot easier. Look for some C++ resources on google, or get a good book from the library, and most of all, keep trying and asking questions.
If learning Qt is your goal, have a look at PyQt. Python is much easier to deal with than C++, especially for the inexperienced. --
eatapple core dump
Thanks Preston... It's solved now. About your advice, I'll keep it my mind. I got a C++ book from Amazon now (GNU C++). I'll read this book carefully during I getting to know more about Qt. And if I have a problem, I'll ask again. Once again, thank you very...very... much. --- Preston <maillist@inbox.lv> wrote:
What happened, most likely, is that you used QT Designer to create the main.cpp file before you saved and named your conversionForm widget. If you replace the #include "unnamed1.h" with #include "FormFileName.h" (where FormFileName is the name you saved your form as with .h for an extension instead of .ui), then it should work.
You may also want to first want to improve your general C++ skills a little before jumping into QT. QT is a great toolkit to use for GUI programming using C++, but a good understanding of C++ makes it a lot easier. Look for some C++ resources on google, or get a good book from the library, and most of all, keep trying and asking questions.
Good luck,
Preston
Prabu Subroto wrote:
Thanks for your respond, Derek..
Here is my main.cpp as below:
patrixlinux@patrix:~/arsip/proyek/metric> cat main.cpp #include <qapplication.h> #include "unnamed1.h"
int main( int argc, char ** argv ) { QApplication a( argc, argv ); conversionForm w; w.show(); a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) ); return a.exec(); } patrixlinux@patrix:~/arsip/proyek/metric>
I don't understand what the '#include "unnamed1.h"' means... I don't have that file in my code. I tried to comment that line with "//" but the same problem still exists. I even have not made the "conversionform.ui.h" because I don't want to make a further program yet. I want to try first to display a form containing textLabel "Hallo Qt".
I joined the mailing list but no respond for my question. that's why I prefer suse-programming-e as I also know (heard) that SuSE guys use Qt to develop our beloved SuSE.
Thanks for your help, Derek. --- Derek Fountain <derekfountain@yahoo.co.uk> wrote:
main.cpp:2:22: unnamed1.h: No such file or
directory
Your main.cpp wants a header file called unnamed1.h, which it's not finding. Did you tell it to include that? Post your main.cpp file.
Alternatively, join the Qt interest mailing list (via the Trolltech website). It's quite busy and very friendly.
--
eatapple
core dump
-- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e
__________________________________ Do you Yahoo!? SBC Yahoo! - Internet access at a great low price. http://promo.yahoo.com/sbc/
-- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e
__________________________________ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/
On Wednesday 19 May 2004 11:07, Prabu Subroto wrote:
Dear my friends...
I tried to develop an application with qt. As the beginning I try to make a very simple application with qt. just display a form contain a label "Hello Qt".
In QT designer: 1. create a new C++ project 2. create your form as a Main Window 3. in the form properties window, give your form the name you want 4. do File/SaveAll, saving the form under the same name as 3. 5. then do File/New to create your main.cpp; this will ask for the main window name. This should get you round the unnamed problem. You do not need to write any constructors or destructors for the form. Cheers, TonyB
Thank you very...very...much Tony. --- Tony Bloomfield <tonyb.lx@btinternet.com> wrote:
On Wednesday 19 May 2004 11:07, Prabu Subroto wrote:
Dear my friends...
I tried to develop an application with qt. As the beginning I try to make a very simple application with qt. just display a form contain a label "Hello Qt".
In QT designer:
1. create a new C++ project 2. create your form as a Main Window 3. in the form properties window, give your form the name you want 4. do File/SaveAll, saving the form under the same name as 3. 5. then do File/New to create your main.cpp; this will ask for the main window name. This should get you round the unnamed problem.
You do not need to write any constructors or destructors for the form.
Cheers, TonyB
-- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e
__________________________________ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/
participants (4)
-
Derek Fountain
-
Prabu Subroto
-
Preston
-
Tony Bloomfield