How can I compile QT 4 dlls with msvc 2019? - qt

I have an old project using QT 4.6.2 that runs on VS 2008. I was able to compile it in VS 2019 with msvc 2019 toolchain but it crashes in run time. I see that the problem happens because when I use the QString::toStdString() function, it involves QTCore4.dll using msvc90.dll (VS2008), but when destroying the std::string the app uses msvc2019. This mismatch ends in the app crash.
I want to fix it by recompiling QTCore4.dll using the msvc 2019 but have no idea how to do this. I got the dll by installing QT and have no instructions how to recompile it.
Is it even possible or is it closed source?
I assume upgrading to QT 5 is also an option but I would like to stay with QT 4 for now.

Qt 5 is largely source compatible with Qt 4. I would first highly recommend trying to compile your project (and fixing any small issues) against Qt 5.
If you need the Qt Declarative module, you can compile it against Qt 5 if you must.
That being said, Qt is released under the Open Source LGPL license.
You can fetch the Qt 4 source code from github: https://github.com/qt/qt
Building Qt 4 involves having perl installed and running configure followed by nmake (for Visual Studio). You will need to set up some new things for Visual Studio 2019, and potentially fix code incompatibilities that the 2019 version compiler digs up.

Related

Unable to add QT version

I'm using QT for the first time to build a GUI. I'm following this Tutorial.
I followed the steps one by one as shown in the screenshot below.
Select the project
I selected Other project>>Empty qmake Project. Next I'm prompted to add the Kits.
Add Kits
I add the Kits, but in the next Tab "Qt Versions", there are no QT versions.
No QT Version
I figured i didn't install any QT Versions during the installation process. so I opened up the "Add or remove programs" and found that these are the components I have installed.
Installed components
Will these suffice to build a Desktop GUI using QT creator or are there any other components I have to install as well?
So, for a first try, I suggest using the MinGW compiler, since it is installed by Qt Maintenance Tool.
If you need to use the MSVC compiled Qt like the one selected in your pick, but you need also to install Visual Studio since you need the MSVC Compiler. If you also need to debug an MSVC Qt Application via QtCreator you need to manually configure the CDB, since the one installed with Visual Studio is not detected by Qt Creator.
Those pieces of information are related to MSVC2017 and Visual Studio 2017. If you intend to use MSVC2019 I don't know how QtCreator manages that.
About your situation is strange, you installed the MSVC Qt so they should be detected in QtCreator (tools -> options -> kits -> Qt Versions). I suggest to completely uninstall Qt and restart the process selecting just the MinGW 64-bit, QtCreator and MinGW Compiler 7.

Installing Qt5.1.1 and making it run with Visual Studio 2010

I am trying to install Qt5.1.1 and have already installed VStudio 2010 Pro, but I stll get the error saying Qt needs a compiler set up to build.
I looked it up, and I only find very complex solutions that are impossible for me to implement.
Can anyone give me specific directions on how I can get Qt5.1.1 working in my laptop?
Btw in case you couldn't tell, I'm a newbie.
Thanks
First, ensure that your Visual Studio installation contains a 32-bit compiler (the official Visual Studio 2010 packages only support 32-bit compilers)
Then, ensure that you've downloaded and installed one of the packages that are marked "Qt 5.1.1 for Windows 32-bit (VS 2010)" from http://qt-project.org/downloads
If Qt Creator still doesn't auto-detect your compiler, add it manually: http://qt-project.org/doc/qtcreator-2.8/creator-tool-chains.html
If you had to add your compiler manually, also add a Kit to combine your compiler with your Qt libraries: http://qt-project.org/doc/qtcreator-2.8/creator-targets.html

problem with QT and visual studio 2010 ultimate in debug build

I install vs 2010 ultimate and "qt 4.7.1-vs 2008" qt-vs-addin-1.1.7. Now every thing is configured but when i make a debug build of qt application i am getting
"The application has failed to start because the application configuration is incorrect".
This is probably because vs 2010 is compiling to msvcp100d.dll where as qt is compiled with msvcp90d.dll. Can you please let me know how the problem can be resolved thanks in advance....
I'm not working with Windows releases for a long long time but if Nokia doesn't provides a compiled release for VS2010 why don't you compile Qt from the source? It takes a while but it's the right thing to do.
PS:
Looking through the Qt Software download page it doesn't seems to have a VS2010 release, at least for the LGPL version. Then, you really need to download the source and build it.
Just in case you need from reference on Qt build process, take a look at this:
http://en.wikibooks.org/wiki/Opticks_Developer_Guide/Getting_Started/Building_Qt_From_Source
Configure options for you case may be different.
Also, be warned that according to this VS 2010 is not a Tier 1 platform for Qt.

Porting QT application from Linux to Windows?

Greetings all,
We are developing a QT application (QT 4.6 LGPL version) in Linux platform.All the libraries we use are cross-platform.
Now we want to port it into Windows and continue develop in Windows.
My questions are:
Which compiler should we use ,Can we use MinGW or Visual C++ compiler?
2.If its Visual C++ compiler, which Visual Studio version should be used ,can we use 'Visual C++ Studio 2010 express' ?
thanks in advance.
The easiest, by far, is to install QtCreator. it includes MinGW and simply opens the same project files as on linux. compile, and go!
A huge advantage of MinGW over VC++ is that it doesn't make you chase circles around getting the right vcredist library for the exact version of the compiler, nor it cares too much about debug/release builds. To deploy, just be sure to copy the same one or two DLLs you have on the development machine. A few more for Qt, but these are well-documented on Qt docs. No hidden surprises.

Qt/QuickFIX - doesn't find some header files

I am using both Qt Framework and QuickFIX engine to create a financial application with GUI.
My problem is that when I compile a program that implements QickFIX engine and Qt Framework, it gives me a compilation error: it doesn't find some header files in MinGW (socket.h, inet/in.h, etc)
I am on Windows 7 and I know that to use sockets you must use winsock.h and so on, but the problem is I have Visual C++ express edition and it's not supported by Qt, so I used Qt Creator and since I have an open source of Qt, QuickFIX engine uses the header files of Linux (socket.h, etc) rather than windows. So it gave me an error.
Please can you suggest me a solution?
I use Visual Studio Express 2010 with Qt. You will need to build Qt with it. When you configure make sure to specify Visual Studio 2010 as the make spec.Last time I built it got hung up on a couple of projects. To get around this you need to clear out some temporary files that Nokia packaged in the installer for some reason. Just google the error for details.
Once you have Qt built you ought to be able to qmake -tp vc your project and then load up the generated Visual Studio project file.

Resources