QT adding compiler - c++

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

Related

How to make Qt Creator use Rosetta and x86 compiler on Mac M1?

I am using Qt 5.15.2 on my Mac mini with M1 chip. This works fine (due to Rosetta). Below is the list of compilers Qt Creator found on this computer, and among them is the C++, x86 64bit that I use. No problem.
I would like to use the same settings on a (somewhat newer) Mac Book Pro (also with M1 chip). Below is the list of compilers Qt Creator finds on this computer, the x86 is now missing!
I do not know if I have a x86 compiler on the new M1-computer. I have installed Xcode and the command line tools for XCode 13.2.
Can I somewhere tell Qt Creator that the deployment target is x86?
Does /usr/bin/clang++ only compile for the ARM/M1-chip, or can it also produce and link to x86 code?
if not, how can I find out if there is an x86 compiler on my new M1-computer?
If the compiler is missing, how to install it?
Any help would be most appreciated!
A few tips that can help, I just setup a project using Qt 5.15.2 on a 2021 M1 Mac.
Note this will likely be different for Qt >= 6.
Can I somewhere tell Qt Creator that the deployment target is x86?
Yes, you can do this using specific argument in the build settings of your kit.
Add the QMAKE_APPLE_DEVICE_ARCHS="x86_64" additional argument to qmake.
Also, add an additional CMake option: -DCMAKE_OSX_ARCHITECTURES:STRING="x86_64"
ℹ️ Click Manage Kits.. in the projects view to open the preferences editor where you can update your CMake configuration.
Does /usr/bin/clang++ only compile for the ARM/M1-chip, or can it also produce and link to x86 code?
With rosetta installed (/usr/sbin/softwareupdate –install-rosetta –agree-to-license), and the configuration above, yes you can compile and link x86 binaries.

Make - Internal compiler Error under QT 5.14.2 "Q_CORE_EXPORT"

I just installed QT Creator with QT under Win10 to build an already existing project. (Under Ubuntu everything went fine running the Make file). I'm not an expert for QT therefore I'm not able to find out how to resolve the error:
C:\Qt\5.14.2\mingw73_64\include/QtCore/qfloat16.h:102:54: internal compiler error: in make_rtl_for_nonlocal_decl, at cp/decl.c:6590
Q_CORE_EXPORT static const quint32 mantissatable[];
My gcc version is 8.3.0 (x86_64-posix-seh, Built by strawberryperl.com project). Is there something missing or broken in the installation?
On windows, you generally need to have a Qt which was built with the same (or compatible, but that can be hard to verify) compiler and relevant build options, as what you are using to build your application.
I doubt you will find a pre-built Qt SDK for that version of gcc, so if you want to use it, you should build Qt from sources. It can be a bit tedious on Windows, there are a fewf prerequisites you have to get etc. I recommend you use the Qt online installer to install a MinGW version of Qt SDK, and matching version of MinGW (also offered by the Qt installer.
I just found out from qmake.stash, that the included script for creating the make file always referenced a false path for the gcc compiler. I therefore build i manually with the QT Creator and it worked as expected. So I guess the fault was due to different paths for gcc in the environmental variables.
Here is the bug, there is a link to the patch: https://github.com/msys2/MINGW-packages/issues/5006
Also you can just downgrade to mingw gcc 8.2.0

The program has unexpectedly finished - QT creator

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").

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.

Setting Qt Creator to use the latest version of g++ and gdb on Windows

I wish to use the C++11 features in a Qt programs compiled by GNU C++ compiler (MinGW) on Windows. By this reason I can not use a version of compiler provided in Qt SDK.
I decided to use the latest versions of Qt, Qt Creator and MinGW. By this reason, I download and install these software separately. It is easy to set up the Qt Creator to use the version of Qt installed in C:\Qt folder and GNU C++ compiler from MinGW installed to C:\MinGW folder, but a debugging does not work then. More specific, I receive error:
"During startup program exited with code 0x0"
How to fix it? What is a correct setting for the debugger in the toolchain options?
QtCreator requires a patched version of gdb to works. It's a workaround
To make the --tty option work under MinGW and
To prevent gdb from freezing when attaching to a suspended process.
You have 2 alternatives (assuming that you are entirely satisfied with the prior installation of the framework and the compiler):
Download the patched gdb binary from Qt's repository or
Download the patches from Qt's site, apply them and build gdb
Install the debugger to the appropriate directory and finally resume the configuration of the debugger.