Qt5 Issues: error: shell32.lib: No such file or directory - qt

I'm trying to learn how to use Qt for dev and have to say it's been a pain from the start.
I installed Qt Creator 5.4 version. Then followed this http://qt-project.org/wiki/Qt_for_beginners_Hello_World.
It defaulted to MSVS so I manually added MinGw. It has a red sign next to it saying that MinGW cannot compile code for the QT version.
I just want to use Qt5 and need an appropriate compiler for it. I'm used to using MinGW in Eclipse for C++ dev.

Your installation seems to be incomplete or inconsistent.
To work with Qt you actually need two things: One is a compiler toolchain (called the "kit" in Qt Creator), the other is the compiled Qt library, which is what is visible in settings under "Qt versions". Both need to fit together for Qt to work.
In case you want to use Qt with Visual Studio, you should select the precompiled Qt version corresponding to your (previously installed) VS version during install when you use the online installer. Or use the offline installer for your VS version. After install, everything finds together itself.
Or you want to use MinGW. Do yourself a favor and use the MinGW version which is installed by the Qt installer, which is different to the one from MinGW.org (it is the 32 bit version of the MinGW-w64 project, which is more up to date than the one from MinGW.org, and has some other subtleties). It is selectable in the installer under "tools". Additionally select the Qt version precompiled with MinGW. After install, select the MinGW Kit for your new project, and everything again will work from scratch. Again, you can use either the offline installer including MinGW-precompiled Qt or the online-installer which has all versions of precompiled selectable to perform that installation.

Related

Self-contained toolchain for Qt for x86 Linux/Windows

I am setting up a Qt project which will be cross-copiled for a given display (running on ARM/Linux). The display will come with a self-contained cross-build toolchain which comprises Qt libraries with a specific Qt version (probably 5.15).
Now I would like to use a specific "static" toolchain incl. Qt libraries to also generate x86-builds of this Qt project (for testing, simulation; building/running on Linux and maybe also on Windows).
I'd avoid using the GCC and Qt development files introduced by the Linux package manager (e.g. apt), because the are not tied to a specific Qt version, i.e. upgrading the OS would always come with the risk to introduce build problems or break compatibility completely.
Are there good-practice approaches to achieve this?
So far I see three options:
Use a docker image
Possible problems:
Finding a image with the correct Qt version
building the Qt application would then work, but to execute it, the compatible Qt LGPL shared libs need to be available to the Qt application binary
Use a x86 -> x86 "standalone" toolchain
Find some standalone x86-toolchain analog to those (x86 -> x86), but additionaly...
it would either have to come with the Qt development files in the correct version
or we would have to build the Qt sources with this toolchain, and then extend the toolchain with the Qt built artifacts
Would be the preferred solution (and currently seems to be the most feasible of the approaches I can think of).
Virtual machine
Possible problems:
Finding a OS version with the correct Qt version
Select a OS version that contains the correct Qt version via package manager.
Not very elegant.
Qt online installer
only provides a limited choice of Qt versions (as of today: 5.15.2, 6.2.4, 6.3.2, 6.4.0) which is probably subject to change in the future

Add 32-bit versions of Qt 5.7 on a 64-bit machine

Want to manually install 32-bit versions of Qt 5.7 so that I will be able to deploy my app to not only 32-bit but 64-bit machines as well.
Initially when I installed it on my 64-bit Windows 7 machine, I only selected the 64-bit components and, hence, I can only select the MSVC2015_64 bit kits in Qt Creator to build my app with.
Since I want to deploy my app to a 32-bit Windows 10 machine, I am trying to add the 32-bit Qt versions to my installation; tried through Tools > Options > Build & Run > Add... with no success. Searched for some answer/guide to the documentation and to other online sources but could not find how to achieve this in Windows.
Is it possible to manually add other Qt versions on a current install or is do I have to reinstall Qt? Also, could I simple install Qt with the desired Qt versions on a different directory than the first installation or will that mess up the PATH variables?
You have to launch Qt Maintenance Tool : Start -> Programs -> Qt -> Qt Maintenance Tool.
Skip the Qt login (unless you are using a commercial version of Qt).
Select "Add or remove components" and click yes. You'll be able to select other kits to download and install*.
Then Qt Creator should automatically add those kits, you'll just have to add them to your project : go to project settings once your project is open, and you'll find "Add kit" button in the upper left corner.
*Qt Maintenance Tool may prompt you to update components first if there's a new version available.
Kits are the key to your problem. A kit in Qt is composed of:
Version of Qt (and i'm not talking about Qt creator)
Compiler (you have to choose the correct compiler corresponding to your Qt Version, i will explain that more in detail, below )
Debugger (correct version 32 or 64 bits).
You can install as many versions of Qt as you wish Qt Creator will usually autodetect them all. Don't worry it won't damage your path, you can also install 2 different compilers (MingW and MSVC a.k.a VS compiler for example).
in Qt site : https://www.qt.io/download-open-source/
pick the version or versions of Qt you want to install and install them (the package include Qt Creator so no need to install it twice)
you also download the correct version of your compilers and debbuggers (if you don't already have them) and install them.
Once you've downloaded all the components and installed them, you go to Qt Creator :
Tools -> Options
in the lhs menu select Build & Run
you can go and check Qt Versions, Compiler and debugger to see if everything was auto-detected well.
if it's ok you can then create your kit :
go to the kits Tab
you can either add a new kit, but i prefer cloning an existing one and then edit it.
select the clone and choose the correct compiler, the correct version of Qt and the correct Debugger, rename your kit so you can recognize it. Save and close.
to use the kit you created you have to choose it in the project menu
see the screenshot below :
you can create as many kits as you wish, so you can have different configurations.
QtCreator can handle any number of "kits", where a kit is a combination of compiler + Qt version + (optionally) a deployment target.
See http://doc.qt.io/qtcreator/creator-configuring.html

Installing Qt Creator with MinGW

So it looks like with Digia taking Qt over from Nokia, that it's quite a mess to get a few simple downloads.
If I now go to the downloads page (http://qt-project.org/downloads), I see that there's a single Qt Creator 2.6.2 download for Windows. When I download this and run the installation, it seems that MinGW is no longer packaged along with it.
I tried to install MinGW 4.4 separately and then add a toolchain, but nothing runs when I try to compile my CMake-based project.
I then came across the Nokia website that is offering Qt SDK 1.2.1; however it now looks that they require you to create an account to be able to download the installer.
Downloading the full set of Qt libraries is probably what is going to be suggested, but that's not the best idea, because I'm basically writing up an installation procedure for a CMake-based, open-source set of libraries that I've been working on for a while (http://tudat.tudelft.nl).
Users aren't happy with having to download all the Qt libraries, since we're not using any of them.
I've completely run out of solutions now (and mind you, this only seems to be a problem for Windows, since when I install Qt Creator on Linux and Mac, GCC auto-detection seems to work fine).
So, in short, does someone have a simple install routine to install Qt Creator and get it to work with MinGW to compile a CMake-based project?
Thanks in advance!
Kartik
PS: I know there are plenty of threads on Qt Creator + MinGW, but they all seem to be outdated now with the recent changes on both the Digia and Nokia websites.
I should add that the problem specifically is not that the toolchains can't be auto-detected under Windows. I've managed to get both MinGW and CMake auto-detected by Qt Creator by adding both to the system path. The problem is that when I then try to open the CMakeLists.txt file for my project, I can't select any generators.
Straight forward:
Install Qt Framework
Install MinGw
Install CMake
Install other stuff, e.g. git
Install Qt Creator
As you already mentioned, the chances are good that Qt Creator gets everything via auto detect. Nevertheless, you should check the Qt settings if everything is in place, e.g. the debugger.
The first time you open a cmake project, Qt Creator (should) ask for the tool chain to use. If you want to change the chain afterwards, delete the build files and cmake directories.
More details to Qt Creator and cmake: http://qt-project.org/doc/qtcreator-2.7/creator-project-cmake.html

Qt Include and QMake error

Qt was messing up on Windows so I deleted it and re installed it with the qt libraries and Qt Creator. Now, whenever I try to open my old project, I get the error that "Qmake is does not exist or is not executable", and none of the Qt headers can be located.
Assuming you're using a recent version of Qt, such as version 4.7.4, and a recent version of Qt Creator, such as the branch 2.3 .*.
Probably somewhere in this process, Qt Creator or the settings for this specific project lost the reference to Qt install.
We first need to find out if Qt Creator knows where Qt is installed. Go to Tools > Options.... Then click in Qt4. Here will show all installed and detected Qt versions.
As you can see, I have one Qt version installed (4.7.4), which was automatically detected.
If you do not have any installed version, you need to indicate a one manually. Simply click Add and point it to the right qmake.exe. Use the paths of the figure as reference. If you are developing a windows/mingw application, just need to add the qmake.exe associated with mingw (c:\qtsdk\desktop\qt\4.7.4\mingw\bin\qmake.exe on my computer) and remember the Version name, we'll need that in next step.
After that, open the project and click on Projects in the lateral bar. You need to Substitute the Qt version. Click on Manage next to it and select the correct version. This should resolve the problem.
Any trouble just comment. Sorry about the creepy english.

How to force Qt Creator to use MinGW instead of Visual Studio

We're trying to compile a project with MinGW on the machine that has both MinGW (with Qt) and Visual Studio installed. Unfortunately, Qt creator prefers MSVS by default, and doesn't see it's very own MinGW (screenshot). Sadly, this results in a lot of obscure errors, because application was written and debugged with MinGW. Is there way to make Qt Creator to use MinGW without killing MSVS?
While installing, choose custom type of installation. Selected libraries for needed compilers in QtSDK->Development Tools->Desktop Qt->Qt-. Screenshot:
Have you made sure your Qt sdk is installed with its MinGW? You can use the Qt maintainance app to make sure its MinGW engine is installed.
Where are those libraries from? Did you compile the SDK yourself? Or did you downloded the libraries?
Try to see what is in the mkspecs directory. There should be a link named 'default'. That links to the specification which is being used. I suppose it is pointing to win32-msvc2008. You can change that but if it is pointing to that specification it means that the Qt libraries have been compiled with that specification (unless it was changed afterwards), which means you cannot use those with MinGW. You should compile the libraries with the correct specification or download the correct package (MinGW version).

Resources