setting up VS platfrom toolset in QtCreator - qt

I have a project based on Qt which use QWebEngine. For compiling this project i've installed Visual Studio Express 2015 and have configured kits. My project is built, all is fine. But now i need to compile my project for Windows XP platform. I know, that for doing this it is needed to change toolset from v140 to v140_xp.
How can i set the toolset from qtcreator?
I tried to determine the difference in compiler options in both cases. For doing that I've created test project in Visual Studio. There i change the toolset and look at Project Properties -> C/C++ -> Command Line Options. But seems that nothing changes there.

Qt WebEngine module does not support Windows XP targeting, so this won't work anyway. Even if it did, you'd need to build a copy of Qt that targets Windows XP - otherwise your application will target Windows XP, but not the Qt library it uses, and it won't work that way.
For completeness sake, here's how you'd do it assuming that you got Qt built targeting Windows XP:
There only two ways to do it currently without patching Qt Creator itself:
Execute Qt Creator with environment variables already setup up for the XP toolset enabled for command line use. I.e. target XP from command line, and launch Qt Creator from there.
Add relevant environment variable settings to the Build environment of the project in Qt Creator.
The details of environment variables needed to target Windows XP are given e.g. here.
For Windows XP portability, you should be using the semi-maintained for of the qtwebkit module. It builds and works on XP, and works with most recent Qt IIRC.
Note: It's certainly possible to target XP using WebEngine and Angle, but it requires lots of patches to current Qt. It's not an insignificant effort, and you'd definitely want to test it on the graphics cards that you intend to target - the DirectX 9 drivers on some of those machines are buggy, and while the code is correct and compiles and runs, it may not work on some systems. I'd say that it's absolutely not worth the effort.

In VS there is an editbin utility, which could be used as follows
editbin file.exe /SUBSYSTEM:WINDOWS,5.01 /OSVERSION:5.1

Related

An installer for Qt apps

I've created a Qt calculator app using Qt Creator 3.6.0 purely in C++ code (I didn't use Designer)
I would like to know how to use Qt to make it installable for publishing.
I ran the app in both Release and Debug modes and have both folders of the two.
I also downloaded and installed Qt Installer Framework Opensource 2.0.1 for my Qt Creator 3.6.0 (the IDE I use for Qt).
And I also have the .dll files needed to run the .exe file.
I've searched the Web for it. But since I'm a novice in Qt I can't do the works properly, or I don't understand. (They seem complicated)
Now, is there any straight forward method to use an installer for the app to make as platform independent as possible?
If so, what installer? And how to do the process? This is the first time for me.

Qt application not a valid 32bit application

I made a simple Qt application. Everything is working well on mt PC. I use Windows 7 SP1 and Qt Creator for building and debugging. When I try to run my program on Win XP I get the error "Not a valid 32 application". I had the same problem when I was making applications with Visual Studio 2012. However I fixed that problem with Visual Studio. In Tools -> Options I made it wo be compiling for Win XP. And everything was working on my PC and on the PC with XP. But I can't find such option in Qt Creator. How can I run my application on Windows XP?
Qt-Creator is only IDE, it uses compiler you tell it to use (I'm assuming it would be VS2012 in your case).
You can check compiler/linker flags in your other VS2012 solution that make a difference (what changes as you set "option compiling for Win XP" when you look to command line input to compiler/linker), and set same flags in your Qt .pro file.
You can see actual input to compiler/linker by going to project properties->C/C++->Command line and Linker->Commnd line respectively in your VS2012 project.
You can set compiler/linker flags in qt using
QMAKE_CXXFLAGS +=
and
QMAKE_LFLAGS +=
in qt .pro file respectively.

Choosing MSVC toolchain

I want to use QtCreator and MSVC as a compiler instead of MinGW. I successfully compiled Qt source code with MSVC 2010. As you would have guessed, I have MSVC 2010 installed on my machine. I also registered MSVC version of Qt in QtCreator, but now the problem is that I can’t select MSVC toolchain in qtcreator.
So far, I found out that QT_INSTALL_LIBS and QT_INSTALL_BINS are not correctly configured for MSVC version of qt binaries. I guess this could be the problem, but I don’t know how I should configure that variables.
Here's the screenshot
Check if you have define the environment variable QTDIR (this can be done in command line, using set command). This allows Qt Creator to auto-detect the value.
Also, could you try to rename the folder not using 'c++', instead use e.g. 'cplusplus', and see if this could also resolve the problem.
You need to set your QMAKESPEC environment variable to "win32-msvc2010" (or create the variable if you don't have it), then restart QtCreator. This tells Qt and QtCreator that you are using the msvc compiler of Visual Studio 2010 for 32bit windows applications.
That should do the trick.
PS: If you have any Windows Explorer windows open you need to close these too after setting the environment variable.
PPS: Press [windows-key][Pause] to quickly access the system properties dialog

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