Unable to get a hello world qt app
I'm trying to get into Qt development, but so far I have been unable to achieve any good result.
I have installed QtCreator with the Qt 5.1.0 toolkit and I have the MSVC2012 (x86 and x64) and mingw compiler on my Windows 7 system.
I have started with creating a new Qt GUI application project and ran through the wizard. And then I have compiled the app. Compiling went fine so I ran the app, but since I press the Run button I get nothing on the screen. In Windows's Task Manager, at the processes tab, I can see there is the executable running (in my case hw.exe) but there is no window popping out on run.
Also, I have tried following some tutorials from the wiki and from the web; they all start with an empty project and to the authors the compiling goes fine, but for me I'm getting warnings and errors like:
@[W] LNK4042: C:\Users\T3STY\Documents\Qt Projects\build-helloworld-Desktop_Qt_5_1_0_MSVC2012_OpenGL_64bit-Release\release\main.obj:-1: warning: LNK4042: object specified more than once; extras ignored
[E] LNK2019: qtmain.lib(qtmain_win.obj):-1: error: LNK2019: unresolved external symbol main referenced in function WinMain
[E] LNK1120: release\helloworld.exe:-1: error: LNK1120: 1 unresolved externals@
Could someone please help me getting my first Qt GUI app compiled right?
I would say, check your .pro configuration if it is a QtWidget based app then you will need a line similar to this:
QT += core gui
after you make sure everything is correct in your .pro run Qmake and try to build and run your app.
You didn't post your example code but hopefully it is OK if you followed some working tutorial.
I actually worked with the base code that the QtCreator wizard creates, that's why I didn't post any code. I guess, the code the wizard creates is not complete for a test? I read on many tutorials that it should be...
Anyway, the .pro file already contains that line. But maybe I'm doing something wrong somewhere else. Would you be so kind to post a working project?
I've been able to make a working GUI application. When I posted the code I was using was incomplete, the Window wasn't created at all.
Thank you for help!