Qt Creator V2.4.1 Windows 7 Tutorial
-
Downloaded Qt Creator Yesterday and have run into a frustrating dead end. Following through tutorial 1, application seems to build but when I run the application from within Qt Creator I get "The program has unexpectedly finished" and "... exited with code -1073741511.
This must be something very basic. I thought I was on to something when I searched the forums and updated to jom 1.0.11 but that still give me an "empower your cores".
I tried building the examples without much luck...
I don't have much hair left as it is, please help me to not remove the remainder,
Thanks
-
Hi.
I am also beginner and I think I cam through something similar to yours. First of all, try to run a very basic program like this below:
@#include <QtGui>int main(int argc, char* argv[]) {
QApplication app(argc, argv);
QPushButton* button = new QPushButton("Hello_word");
button->show();
return app.exec();
}@If it does not run, then you may have the same issue as me. Try to change how you build your application. What I mean by this is something I showed in "this":http://qt-project.org/forums/viewthread/19172/ thread. The very last screenshot shows how I set the compiler to build the application and it was set to MinGW. I did it and it started working. Hope, it can help. I am not expert so It may not work. I hope it will. Good luck.
-
Hi Zebbik,
I tried to build your simple application : I got the following Linker Error :
qtmaind.lib(qtmain_win.obj):-1: warning: LNK4099: PDB 'vc100.pdb' was not found with 'qtmaind.lib(qtmain_win.obj)' or at 'C:\Users\pcrampton\Desktop\Qt\Test-build-desktop-Qt_4_8_1_for_Desktop_-_MSVC2010__Qt_SDK__Debug\debug\vc100.pdb'; linking object as if no debug info
Any clues?
-
Does your toolchain match the version of the library you're building against? From these messages it looks like you have the VS2010 build of Qt - are you using VC++ 2010 to build the app?
-
Dear Swatwork,
Not sure how to check. I am unfamiliar with Qt and thought that by following the tutorials I would become a little more familiar. In answer to your second question, no, I am using Qt Creator but I did download the MSVC2010 Add-In and installed it. I also tried the MinGW build and hit the Run (green triangle) with no luck. Here is the output from the MinGW build :
09:50:54: Running build steps for project Tutorial_01...
09:50:54: Configuration unchanged, skipping qmake step.
09:50:54: Starting: "C:\QtSDK\mingw\bin\mingw32-make.exe"
C:/QtSDK/mingw/bin/mingw32-make.exe -f Makefile.Debug
mingw32-make.exe[1]: Entering directoryC:/Users/pcrampton/Desktop/Qt/Tutorial_01-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug' mingw32-make.exe[1]: Nothing to be done for
first'.
mingw32-make.exe[1]: Leaving directory `C:/Users/pcrampton/Desktop/Qt/Tutorial_01-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug'
09:50:56: The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited normally.and the run :
Starting C:\Users\pcrampton\Desktop\Qt\Tutorial_01-build-desktop-Qt_4_7_4_for_Desktop_-MinGW_4_4__Qt_SDK__Debug\debug\Tutorial_01.exe...
The program has unexpectedly finished.
C:\Users\pcrampton\Desktop\Qt\Tutorial_01-build-desktop-Qt_4_7_4_for_Desktop-_MinGW_4_4__Qt_SDK__Debug\debug\Tutorial_01.exe exited with code -1073741511I also tried the Run with Debugging :
I got a popup - Executable Failed - During Startup Program exited with code 0xc0000139.
-
If you have problems setting up your toolchain, just download the Qt SDK and install it, everything should be set for you.
You don't need the MSVC2010 Add-In to use Creator, it is for Visual Studio only.
-
From the output messages you provide it looks like you're running the mingw toolchain.
The 0xc0000139 error code means DLL entry point not found so it looks like some runtime mis-match between libraries. You might want to confirm that you're running against the same version of Qt that you are compiling against. The output shows that the mingw build isn't actually doing anything as it thinks the target is up to date.
Try deleting the build directory e.g. "Tutorial_01-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug" and performing a completely fresh build using the Mingw version of the library.
-
Still no luck. I kind of followed utcenter's and removed QtSDK, Qt MSVC Add-in and Qt Windows Libraries for VS2010. I then re-installed only QtSDK. I then took Swatwork's advice and removed the newly created build-desktop folders too.
The result is the same - when I hit Qt Creator's green run button I get The program has unexpectedly finished and the same error code.
Interestingly, the Desktop Build options still present me with the 2 MinGW options and the Desktop MSVC2010 options (even though I removed the VS2010 add-in). I was expecting that to disappear.
-
You might need to recreate the build configuration for your project. The easiest way to do this is to close the project in Qt Creator, go into the project folder and delete the .user project file (this will be named something like myproject.pro.user), reopen the project in Qt Creator and select the appropriate configuration when prompted. Clean out any previous builds and try a new build.
-
[quote author="Gruntstunt" date="1343783781"]Hi Zebbik,
I tried to build your simple application : I got the following Linker Error :
qtmaind.lib(qtmain_win.obj):-1: warning: LNK4099: PDB 'vc100.pdb' was not found with 'qtmaind.lib(qtmain_win.obj)' or at 'C:\Users\pcrampton\Desktop\Qt\Test-build-desktop-Qt_4_8_1_for_Desktop_-_MSVC2010__Qt_SDK__Debug\debug\vc100.pdb'; linking object as if no debug info
Any clues?
[/quote]
Hi Gruntstunt,
I found Qt SDK 1.2.1 installs three compilers: MinGW 4.4.x, MSVC 2008, and MSVC 2010. When you make a project it sets MSVC 2010 (SDK 1.2.1) by default. I will try to tell you what I did to successfully compile this very first project with main file I quoted.- Open Qt Creator or close all projects and make sure you are in "Welcome" tab
- Either press "Create Project ..." or from menu choose "New File or Project..." (CTRL+N)
- Choose "Other projects" from the left window
- then choose "Empty Qt Project" from the list in the right window
- In the "Introduction and Project Location" frame, name your project--the "Name" edit line (on the right), e.g. "TestFile" and remember where the project is created ("Create in" text line)
- Click "Next" and you should be in "Target Setup"
- Choose only "Desktop", tick off "Use Shadow Building", and choose "For Each Qt version one debug and one release" for the text line: "Create Build Configuration", and then click "Next"
- In "Summary" frame just click "Finish"
Now you should have a project file named "TestFile.pro". Do this now:
- Go to the tab "Projects" and make sure under "TestFile" (your project name) "Targets" is active
- Make sure under Desktop name "Build" is active
- Make sure that under "Edit build configuration:" you can see "Qt 4.8.1 for Desktop - MinGW (Qt SDK) Debug". Otherwise, choose it from drop down list
- Don't change anything else
Go to "Edit" tab and do this:
- Choose "New File or Project..." (CTRL+N) or right click on your project name "TestFile" and choose "Add New..." from context menu
- Under "Files and Classes" (left bottom window) choose "C++"
- Choose "C++ Source File" from the right window
- Click on "Choose..."
- Name your source file as "main" and make sure you are still in your project path "xxxx<project name>(if you followed me it will be something like "xxxx\TestFile")
- click "Next" and make sure you are adding this source file to your project (for instance "TestFile.pro)
- Click "Finish"
Now you should see "main.cpp" under the Sources folder. Copy /paste the code I provided before. Either choose 'Build Project "TestFile"' from "Build" menu or press CTRL+B or click on hammer icon at the left-hand side bottom corner and you should successfully build your application.
-
If you couldn't find any problems with it, check the size of you buildpath. I had problems with the generated build paths when shadow build is enabled. The created path was somehow to long and it gave errors when trying to run the application.
It might not be your problem, but it is worth looking at, just to exclude it.
Furthermore as you are using QtCreator you are probably also using the MinGw toolchain. Be sure to set the toolchain and qt version correctly in the projects build settings:
- Select you project as startup project
- click the Project button on the left
- fill in the correct Qt Version: probably "Qt 4.8.1 for Desktop - MinGW (Qt SDK)
- Set the toolchain: probably "MinGw as a GCC for Windows targets
- enable shadow build (not really necesary)
- make the build directory shorter!!!
Check whether this works.
-
Dear Zebbik, AngelsRaven and Swatwork,
Thank for for your patience and your perseverence - I still can't get it to build. I uninstalled everything, re-installed the QTSDK. I followed Zebbik's thorough instructions to the letter and still have the same problem. I also heeded Swatwork's advice but since I have been creating a whole new, if very tiny project each time, I don't think this is the problem. AngelsRaven - I have a quite short path name so I don't think it is that. And I have been selecting each of the build options, one at a time, clutching at straws, none with any luck.
My Compile Output and Application Output are shown below. Tell me a little about g++? What intermediate files should I see in my project folder.
Interestingly, when I browse into the debug folder there is an executable Test_3.exe but when I try to run it I get a popup "The Program can't start because mingwm10.dll is missing from your computer. Try reinstalling the program to fix this problem". What does this mean?
Starting C:\Users\pcrampton\Desktop\Qt\Test_3\debug\Test_3.exe...
The program has unexpectedly finished.
C:\Users\pcrampton\Desktop\Qt\Test_3\debug\Test_3.exe exited with code -107374151121:06:42: Running build steps for project Test_3...
21:06:42: Configuration unchanged, skipping qmake step.
21:06:42: Starting: "C:\QtSDK\mingw\bin\mingw32-make.exe"
C:/QtSDK/mingw/bin/mingw32-make.exe -f Makefile.Debug
mingw32-make.exe[1]: Entering directoryC:/Users/pcrampton/Desktop/Qt/Test_3' g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtGui" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\ActiveQt" -I"debug" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\win32-g++" -o debug\main.o main.cpp g++ -mthreads -Wl,-subsystem,windows -o debug\Test_3.exe debug/main.o -L"c:\QtSDK\Desktop\Qt\4.7.4\mingw\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4 -LC:\OpenSSL-Win32_full\lib mingw32-make.exe[1]: Leaving directory
C:/Users/pcrampton/Desktop/Qt/Test_3'
21:06:55: The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited normally. -
From what I can see, it looks like the application is built properly! Are you sure there is not anything else that prevents the program from running, any kind of defense program, firewall, anti-spyware etc?
You have exactly the same log as mine!!! Which I assume means qmake did its job!
@02:52:13: Running build steps for project TestFile...
02:52:13: Starting: "c:\qtsdk\desktop\qt\4.7.4\mingw\bin\qmake.exe" "D:\Documents\Programming C++\Qt\TestFile\TestFile.pro" -r -spec win32-g++
02:52:14: The process "c:\qtsdk\desktop\qt\4.7.4\mingw\bin\qmake.exe" exited normally.
02:52:14: Starting: "C:\QtSDK\mingw\bin\mingw32-make.exe"
C:/QtSDK/mingw/bin/mingw32-make.exe -f Makefile.Debug
mingw32-make.exe[1]: Entering directoryD:/Documents/Programming C++/Qt/TestFile' g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtGui" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\ActiveQt" -I"debug" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\win32-g++" -o debug\main.o main.cpp g++ -mthreads -Wl,-subsystem,windows -o debug\TestFile.exe debug/main.o -L"c:\QtSDK\Desktop\Qt\4.7.4\mingw\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4 -LC:\OpenSSL-Win32_full\lib mingw32-make.exe[1]: Leaving directory
D:/Documents/Programming C++/Qt/TestFile'
02:52:21: The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited normally.@BTW, you still seems to work with Qt 4.7.4. I explicitly compiled the test files using this compiler but usually I change it to Qt 4.8.1 MinGW.
-
Qt SDK does not install any version of MSVC. We are not allowed to distribute the code. So that must have been on your computer before you started the SDK installer.
Creator will choose a compiler that should produce working binaries together with the Qt version you selected. So if you are using a mingw Qt, then none of the MSVC compilers should be available when working with that Qt version (but they will show up again when selecting a Qt built with the right MSVC version).
-
To my great shame, I gave up! I de-installed QT and set it aside. Last year I installed Ubuntu on a little Toshiba laptop and installed QT there - it worked fine - the examples built and ran. I started to build simple QT programs on Ubuntu. In the last few days, on my Windows 7 laptop, I installed QT5.2.1 and it works just fine, straight off the bat. I am still baffled as to why I couldn't get the previous attempt working. I still feel indebted to the fine people that tried to help me before. I am not writing anything ground-breaking - I started with ProgrammngKnowledge's YouTube videos (24 and 27 are the best fits for most of my "Read an ascii file of numbers, process them and write them to a new file). I have just started tweaking these baby steps and hope to be productive again.
Thanks to everyone that helped me!