PDA

View Full Version : [HELP] window won't show after build



jsmi
9th March 2010, 15:51
Hello!

I'm completely new to Qt and have been checking it out for couple days for now. I've tried to run this simple "http://zetcode.com/tutorials/qt4tutorial/breakoutgame/breakout (http://zetcode.com/tutorials/qt4tutorial/breakoutgame/)" game example which I found. First I got this error when running the code ( d:\Qt\2010.02.1\qt\lib/libqtmaind.a:-1: error: In function `WinMain@16': ) and it didn't compile at all. Adding empty main() function solved this. But now the code does build without errors - but only problem is that no window what so ever pops up or signals that the program even was launched after building. Any help ?

I have some background from basic-like languages and I'm trying to get in touch with Qt and figure out what everything I need to get simple image drawn from a file to specific coordinates, which could be changed- for example- via pressing key. This BreakOut seems to have all but I'm having this problem when trying to run it.

I was able to get other pieces of code running without any similar problems, so I'll assume it's in the code.

Everything needed is included in the attachment.

Thanks and sorry for the bad grammar. Hope you understood my problem.

toutarrive
9th March 2010, 15:57
Create your main in a separate file

To Have an app running and entering the Qt event loop:


int main(int argc, char* argv[])
{
QApplication app(argc, argv);
YourClass inst;
inst.show();
return app.exec();
}


See the doc and Qt demo for the basics.

jsmi
9th March 2010, 17:29
Did like you said and added main.cpp to the project with the code you described, but now the window is showing alright, but it's totally blank..

starting to look like it's little bit too big first Qt project for me to get this Breakout example working.. But thanks anyways toutarrive.

toutarrive
9th March 2010, 22:17
Keep going...