Building a Qt 4.8 application on Visual Studio - qt

I'm working on building Open-Sankoré project (https://github.com/Sankore/Sankore-3.1) which is made by Qt 4.8-msvc compiler..
But, visual studio 2015 only works with Qt5 and doesn't accept Qt4 packages directly..
So my question is whether there's any walk-around that could be done to make visual studio build Qt 4.8 projects ?

You would have to compile Qt4.8 from source if you want to use Visual Studio 2015 with that exact version (4.8). There is no official release of Qt4.8 that was built using msvc2015.
If you are really tied to the Qt4.8 version, my suggestion would be to download and install lower version of Visual Studio and the corresponding compiler, e.g., msvc2008.
Although, before doing so, I would confirm if the project you are trying to build is really bounded to the Qt4.8 version. It might work as expected with the higher Qt version; or with some added modifications.

Sankore is a bit of a mess and is abandonware, but I've forked it and ported it to Qt 5 and it was not a big job. The build system is still iffy and I haven't tested it on anything but OS X.
It currently builds and functions from a stand-alone top project under Qt Creator, i.e. the dependencies (other than Phonon) get built alongside the rest of it.
Phonon builds under Qt 5 - see phonon4qt5. It needs cmake and may be a bit iffy. Only a few classes need phonon in Sankore, and thus require porting over to Qt Multimedia. That should be the first order of business if you wish to work on the code.
Check out the qt5-compat branch from these repositories:
https://github.com/KubaO/Sankore-3.1
https://github.com/KubaO/Sankore-ThirdParty
I'm accepting pull requests, of course.

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

How to set up QTCreator compiler

I'm completely new to qt Creator I have never ussed it before so I just installed it. Cause I need to change a little thing of this amazing program I'm ussing to graph serial data comming from an Arduino sensor:
https://os.mbed.com/users/borislav/notebook/serial-port-plotter/#commentform
Basically I'm doing an electrocardiogram and this program works perfectly but I need to change the colors cause is a standard medical thing to read the heart data in a white backround and the graph in color black. (this program has a black backround and a red graph).
And that's basically all I need, an executable program with just that colors, so I thought I try to edit the code but after I open this project in QT, it appears an error:
13:37:46: Configuration is faulty. Check the Issues view for details.
Error while building/deploying project prueba1 (kit: Desktop Qt 5.11.1
MSVC2015 32bit)
When executing step Make, QT Creator needs a compiler set up to build, configure a compiler in the kit options.
How does this can be done? Step by step. Thanks so much, I'm new to this plataform.
If you want to use MSVC 2015 in Qt Creator you have to install it manually.
You can get from any free version:
Visual Studio Community 2015
Visual Studio Express 2015 for Windows Desktop
Visual C++ Build Tools 2015
Note that you can also install the MSVC 2015 compiler as part of Visual Studio 2017, but Qt Creator does not support it.
Also note that you have to install the CDB debugger manually to debug your program, it is included in the Windows SDK.
If you are a beginner, it might be easier to use the MinGW toolchain. You can install it directly from the Qt Maintenance Tool.

Can't make Qt Creator Work

I've downloaded and installed Qt Creator from its online installer and the latest version but when i try to create a Qt Console Application i get the following error. I haven't touched options. The picture is an error from when i tried to open a file from my professor but i get the same error when i try to create a new one. It could be pretty simple but its the 1st time im using this program as a student and have no idea whats going on. Thanks in regards for your timeenter image description here
If you are using Qt Creator with MSVC Compiler (Visual Studio), you need to also download the Visual Studio Compiler. Qt for MSVC doesn't come with a compiler.
It seems that you are trying to compile with VS 2017. You can Download Visual Studio 2017 from: https://www.visualstudio.com/es/downloads/
Express is free, the other two are paid, but don't download VS Code, it's for another purpose.
Alternatively, you can download only the compiler from: http://landinghub.visualstudio.com/visual-cpp-build-tools It's ligther but you don't get the IDE.
Also, for debugging, if you are on x86 or x64, download Windows CDB from: https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/debugger-download-tools
After you install this, you can reboot Qt and then it will show it has the appropiate compiler and debugger, like this (note that I use VS 2013):
There is another option if you don't want to download or use Visual Studio. Go to the Qt Maintenance Tool (uninstaller), Add or remove components, then install MinGW binaries of your favorite Qt Version, like this:
MinGW is free and it comes bundled with Qt, so you can build and run (and debug!) right away.

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

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.

Linking error because of different versions MSVC and Qt libraries

I am having trouble with compiling a Qt project using the MSVC 2012 compiler. I downloaded Qt first, then realised I didn't have a proper compiler yet, and then downloaded Microsoft Visual Studio Express 2012 and its msvc compilers.
However, whenever I try to compile something in Qt Creator, it gives the following error:
qtmain.lib(qtmain_win.obj):-1: LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match with value '1700' in glwidget.obj
So my understanding of what this means is that my Qt libraries are of a different (older) version than my msvc compiler. But I am not sure how to fix it, or how to get other/newer libraries. Some googling told me that the following code added to the Qt .pro file should solve things:
QMAKE_COMPILER_DEFINES += _MSC_VER=1700 WIN32
But that didn't have any effect. Also, using '1600' instead of '1700' didn't help. Any ideas on what will?
I am working on a 32-bit Windows 7 system, if that's any help, and I'm using Qt 5.0.0.
You need binaries compiled for the Visual Studio 2012. Since there is no official (or unofficial) precompiled binaries available, you need to compile them by yourself.
This should not be complicated process, but it can be hard and frustrating for beginners to do to it, so I would suggest you to follow already given advice and to download VS2010 (afterall, it will take less time to download and install it than to compile Qt from source).
You have to use MSVC 2010, because the libraries are built using it. Try Visual C++ 2010 Express.

Resources