The program has unexpectedly finished - QT creator - c++

I am trying to use QT creator to develop GUI/Console applications using QT framework. I am using windows XP. I installed QT 4.8.3 and mingw. Both are installed without any error.
And then I installed QT creator.
QT Version: Qt 4.8.2 in PATH (4.8.2)
Mingw(manual)
Compiler path: C:\MinGW\bin\g++.exe
Debugger path: C:\MinGW\bin\gdb.exe
mkspec: win32-g++
EnvironmentVariables:
QTDIR, PATH, MinGW,
PATH includes 4.8.2\bin; mingw\bin
INCLUDE : 4.8.2\include
When i try to develop an application using qt creator, it has been built properly and binary is also generated without any error.
But when I try to run the application, It is crashed saying that
The program has unexpectedly finished.
C:\Qt\4.8.2\examples\widgets\analogclock-build-desktop-Qt_4_8_2_in_PATH__4_8_2__Debug\debug\analogclock.exe exited with code -1073741819
This crash came for example application provided by QT library( it is analog clock)
Please try to help me in this, Do I need to set any variables or other
Thank alot.

I had exactly the same problem and solved it yesterday.
If the output of g++ --version doesn't say something like 4.4, this is binary incompatibility. You'll have to get MinGW 4.4. It is included in QtSDK, or at least was.
Next, configure your QtCreator settings ("Build & Run > Toolchains").

Related

Qt cannot load cocoa plugin

I'm trying to compile and run an application on a MacBook using Qt Creator. There are no issues compiling the project, but when I try and run it, it seems to be unable to load a plugin.
Could not load the Qt platform plugin "cocoa" in "" even though it was found.
The application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
This error occurs both when trying to run the application from Qt Creator or via Finder. It seems to only happen when I use the CMake build system (no issues when using QMake), but my existing project that I need to deploy on MacOS uses CMake.
My steps to reproduce are:
Install a completely clean MacOS (no user data)
Install Xcode 11
Install CMake 3.15
Install Qt 5.13.1 MacOS package
Open QtCreator->New Project->Qt Quick Application - Scroll
Set build system to CMake (important)
Compile and notice error
I am using:
Qt 5.13.1
macOS Catalina 10.15
Apple Clang 11
I recognize that for final user deployment I will need to use the macqtdeploy tool to copy the Qt libraries to the executable folder, but I should be able to run my app from QtCreator without doing this? Especially as it works fine when using QMake.
So it ended up being some kind of name resolution thing where Qt Creator couldn't decide whether to use the debug or release versions of the framework. Supplying DYLD_IMAGE_SUFFIX=_debug fixed this (add this to the environment section under Kits).

Deploying Qt application on Windows/Linux, developing on MacOS

I am trying to send my current program to a colleague. He's on Linux, I'm on MacOS. The result of my release build is an .app file. I would like to have a binary executable through ./binary. There's a Makefile in the folder, but it throws make: Nothing to be done for 'first'., so I guess I can't use that.
I am running Qt 5.4.1, Qt Creator 3.4.0. Compiling through GCC/CLANG.
Is there a way to do this?

QT adding compiler

I have QT 5.3.1 for Android (Windows), downloaded from http://qt-project.org/downloads with minGW 4.8.
Now I want to use MinGW 4.9 compiler.
To do so, I download mingw-w64 build [i686, posix, dwarf], and install it to separate folder.
Then, in QT creator, I add compiler in the "Build&Run" options.
Now when I compile something with -std=c++1y flag, in release mode - my program crashes at once (even window does not appear), and in debug mode I get :
During startup program exited with code 0xc0000139
What I do wrong?
I use Qt build from qtx64. It is built using MinGW 4.9 and has dwarf,seh,sjlj builds for x86/x64.
To use it you can create Qt Creator kit with it. You can use Qt Creator from qt-project.org but It should be configured like this:
Configuration images

building Qt 5.2.0 with mingw 4.8.1

this is the first time i am trying to build Qt from source. so i need help from a expert. previously i used qt by installing it using their offline installers. but open cv library cannot be used with it. so i need to build qu frim source. im using win 7 64 bit OS.
i installed active perl, active python, ruby and git. the niwest versions and and added them to path. my path variable llist looks like follows.
then my mingw gcc version looks like follows.
then i build and installed ICU librarys as discribed in http://qt-project.org/wiki/Compiling-ICU-with-MinGW
then opened a cmd as adminisrtator and cd into qt extracted folder and configured as
configure -prefix %CD%\qtbase -opensource -nomake tests -opengl desktop
after configure complets then mingw32-make
it tooks about 1 hour in my i5 2.6ghz processor and ended with following errors.
what may be dhe mistake. am i doing enything wrong. has enybody successfully compiled Qt 5.2 with mingw 4.8.1 on a win 7 64bit system. if qt build successfully will it end with a messsage that qt was build successfully or somthing similar.
i know qt creator can be installed seperatly. but qt designer, will it also be built with qt librarys. can some expert help me with this issue. im trying this for several days.
eny helpwill be highly appricated... thank you....
Try to run make again. It was the same for me.
After two tries it compiled successfully.
I don't remember if it was the same error, but it always fail first time for me and then after running make again it compiles.
Previous versions didn't have this problem.
I have now problem compiling my code, because gcc crashes, but that's different problem.

Qt GUI application build settings in Qt Creator

While I develop a small GUI application using Qt Creator (MinGW in Windows), the compilation is successful, and the binary is generated. But application is not ran, it gets crashed.
Below is my configuration setup:
Qt Version: 4.8.2
MinGW: compilerpath: C:\MinGW\bin\g++ debugger: C:\MinGW\bin\gdb
If I don't use Qt classes (QApplication, QWidget or QString), it works fine. I mean if I use std lib functions, it works fine.
Can any one suggest please?
What is your g++ version? You need to use g++-4.4 with Qt binaries downloaded from their site.