I have Visual Studio 2017 Community edition installed on my PC.
Recently I installed Qt5.10.1.
I generated a VS project from one of the example .pro files:
qmake -tp vc cube.pro
However when I open this VS project and build it I get the error:
The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution".
How do I specify once for all that qmake shall target Windows SDK 10.0 instead of 8.1 so that I don't have to retarget manually each time I generate a VS project with qmake?
You cannot select Windows SDK version from qmake.
qmake expects that the environment is correctly setup before it is run.
If you use the command line directly, you will see the following message: Remember to call vcvarsall.bat to complete environment setup!.
This means that you have to run vcvarsall.bat with the proper options to setup the MSVC toolchain including your selected Windows SDK version.
Some examples:
# MSVC 2017 for 64 bit
vcvarsall.bat amd64
# MSVC 2017 for 64 bit using Windows 8.1 SDK
vcvarsall.bat amd64 8.1
# MSVC 2017 for 64 bit using Windows 10 SDK version 10.0.10240.0
vcvarsall.bat amd64 10.0.10240.0
# MSVC 2015 (installed with 2017 installer) for 64 bit using Windows 10 SDK version 10.0.10240.0
vcvarsall.bat amd64 10.0.10240.0 -vcvars_ver=14.0
And the help message from vcvarsall.bat:
Syntax:
vcvarsall.bat [arch] [platform_type] [winsdk_version] [-vcvars_ver=vc_version]
where :
[arch]: x86 | amd64 | x86_amd64 | x86_arm | x86_arm64 | amd64_x86 | amd64_arm | amd64_arm64
[platform_type]: {empty} | store | uwp
[winsdk_version] : full Windows 10 SDK number (e.g. 10.0.10240.0) or "8.1" to use the Windows 8.1 SDK.
[vc_version] : {none} for default VS 2017 VC++ compiler toolset |
"14.0" for VC++ 2015 Compiler Toolset |
"14.1x" for the latest 14.1x.yyyyy toolset installed (e.g. "14.11") |
"14.1x.yyyyy" for a specific full version number (e.g. 14.11.25503)
The store parameter sets environment variables to support Universal Windows Platform application
development and is an alias for 'uwp'.
For example:
vcvarsall.bat x86_amd64
vcvarsall.bat x86_amd64 10.0.10240.0
vcvarsall.bat x86_arm uwp 10.0.10240.0
vcvarsall.bat x86_arm onecore 10.0.10240.0 -vcvars_ver=14.0
vcvarsall.bat x64 8.1
vcvarsall.bat x64 store 8.1
If you use Qt Creator, you are out of luck. Qt Creator just detects the installed MSVC toolchains, but does not provide any means to add options to the vcvarsall.bat call or to manually add an MSVC toolchain.
Please read the answer of Benjamin T first. This answer elaborates on how it can be configured using QtCreator
QtCreator allows to specify the arguments passed to vcvarsall.bat. Go to Tools > Options > Kits > Compilers:
Clone the desired Auto-detected compiler(s)
Fill in the desired Windows SDK version in the last field of Initialization:
Optional: update the Name to be able to find it back easily in the next step
Under Kits > Kits, change the compiler(s) to your newly created ones (for the desired Kits).
Related
I want to build Qt 5.12.4 on Windows 10 to have qtwebengine with proprietary codec for x86 applications but I get the 64-bit cross-building or native toolchain is required error as follows by running qmake .\qtwebengine -- -webengine-proprietary-codecs command.
Before running qmake command, I do the following steps:
Run Windows command prompt as Administrator. change directory to
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build
and run the following script:
vcvarsall.bat amd64_x86
I run this command because I want to build Qt WebEngine for x86 applications.
Change directory to
D:\Qt\Qt5.12.4\5.12.4\Src
and run the below command:
configure -webengine-proprietary-codecs
After this configuration setting, I got this result:
I installed these Qt webengine compile prerequisites:
-Python 2.7.15
-Bison, Flex from here
-GPerf(32bit) from here
-ActivePerl(64bit) from here
-LLVM(64bit) from here
-Visual Studio 2017
-Windows 10 SDK
I also add them to Windows path and restart my machine.
Besides, I also install MSVC 2015 64-bit, MSVC 2017 32-bit, MSVC 2017 64-bit, Sources, Qt WebEngine, and Qt Network Authorization components.
For windows I compiled qtwebengine with proprietary codecs using a bat file.
create qt5vars.bat. Paste below lines. Put this file in D:\Qt\Qt5.12.4\5.12.4\Src folder.
#echo off
REM Set up \Microsoft Visual Studio 2015, where <arch> is \c amd64, \c x86, etc.
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat" amd64_x86
REM Edit this location to point to the source code of Qt
SET _ROOT=D:\Qt\Qt5.12.4\5.12.4\Src
SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
SET _ROOT=
REM Keeps the command line open when this script is run.
cmd /k
Run the bat file.
Note: for qtwebengine compilation you need to enable the long path name support otherwise compilation may fail. To enable it use below link:
https://superuser.com/questions/1119883/windows-10-enable-ntfs-long-paths-policy-option-missing
Recently I tried to upgrade Qt to 5.8.0 on Windows 7 32bit from Qt5.6.2 MSVC 2013, and I saw strange issues.
I downloaded and installed Visual Studio 2015 from this link: https://www.visualstudio.com/downloads/
After I installed Qt 5.8.0 MSVC 2015 version, Qt Creator 4.2.1 can be launched. From the welcome page, I selected the example named: "Address Book Example". And then after clicking "Configure" project, the project is listed in Qt Creator.
Now I tried to build the project, which was successful. But when I tried to run the project, I got the following error messages:
Starting C:\Qt\Examples\Qt-5.8\widgets\itemviews\build-addressbook-Desktop_Qt_5_8_0_MSVC2015_32bit-Debug\debug\addressbook.exe...
The program has unexpectedly finished.
C:\Qt\Examples\Qt-5.8\widgets\itemviews\build-addressbook-Desktop_Qt_5_8_0_MSVC2015_32bit-Debug\debug\addressbook.exe crashed.
I didn't see this kind of error before when I was using Qt5.6.2 with MSVC 2013. I also tried the following things:
Reinstall Qt5.8.0 MSVC 2015 using offline installer
Reinstall Qt5.7.1 MSVC 2015 using offline installer
Reinstall Qt5.6.2 MSVC 2015 using offline installer
Reinstall Qt5.8.0 using online installer, in which I chose MSVC 2013 and MSVC 2015
I still kept getting the same error messages.
When I went to the debug folder, double clicked the exe file, it said some Qt dlls were missing. I then manually copied to the debug folder, then the exe can be run with no problem.
Now I want to run app from inside Qt Creator, but not sure what is the issue with Qt Creator 4.2.1. I researched in Google for a few hours, but still cannot find out the reason why Qt Creator cannot run projects even it's own Example projects. (same errors for my own projects)
I feel it must be something to do with Qt creator environment/settings. Anyone has any ideas about this problem?
Update 1:
I tried to use MinGW with Qt Creator, the addressbook example can be run correctly. Looks like it's related to MSVC 2015. I need MSVC 2015, because all other environments don't support webenginewidgets, and I got:
:-1: error: Unknown module(s) in QT: webenginewidgets
Not sure if this is a bug in Qt or Qt creator.
Update 2:
In my Qt Creator, I saw warning icons for MSVC 2013 and MSVC 2015 compilers, please see the screenshots below:
I finally resolved the issue. The reason is that the Windows 10 SDK is missing.
After I download and install all default components of the Windows 10 SDK, everything worked on Windows 7 32bit.
Basically, to make sure we can use Qt5.8.0+ on Windows (including Qt WebEngine), we need to install both:
Visual Studio 2015, and
Windows 10 SDK
I'm late but I've found the main culprit is "ucrtbased.dll".
I didn’t install Windows 10 SDK.
I'm on Windows 7 SP1 x64, Qt 5.9.2 with Visual Studio Build Tools 2015 (v14.0.25420.1) and Windows 8.1 SDK with MS Debugger Tools (CDB) installed. The Release Configuration builds are without any issue but the Debug Configuration exhibits the same crash behavior. The fix is simple. The normal install of Visual Studio Build Tools 2015 with Win8.1 SDK places "ucrtbased.dll" in "C:\Program Files (x86)\Windows Kits\10\bin\x64\ucrt" for 64-bit and "..\x86\ucrt" for 32-bit builds - even the Windows 10 SDK is not installed. If these are included in system path, or copied to the Qt's current project build folder, the issue is simply resolved.
When I attempt to compile a skeleton project I get a version error: Msc_ver: 1900 does not match 1800 in moc_test.obj . I'm running qt 5.7.0 with add on 1.2.5 in visual studio 2013. I have checked the platform tools entry in project properties is 2013.
Incase it makes a difference, I do have vs 2015 installed as well.
Any help appreciated
Thanks
try using -spec win32-msvc2013 in your qmake command instead of -tp vc:
qmake CONFIG-=release CONFIG+=debug -spec win32-msvc2013
also make sure you dowloaded Qt for Windows MSVC2013 32-bit
I had an app I was developing in asp.net 4.5 and I wanted to move it to asp.net core and run on linux server (ubuntu).
I've been having a number of challanges and unfortunately current documentation is not helpful.
so...
How should I package the app?
The tech docs suggest building with the following command
dnu publish --runtime dnx-coreclr-linux-x64.1.0.0-rc1-update1
However I tried this on my local machine and it didn't have option to deploy linux version. When I run on server it comes up with a number of problems (covered later). So should I do this on server or get working on local machine.
NB: I read in another stack overflow question that as long as its coreclr it doesn't matter whether its win or linux?
I imagine after this is answered more questions will emerge..I've had so many issues with Core I'm wondering whether anybody has actually manged to deploy on app to Linux environment!
Any help would be greatly appreciated!
Update
To provide further information current runtimes on local machine are...
Active Version Runtime Architecture Location Alias
------ ------- ------- ------------ -------- -----
1.0.0-beta5 clr x64 C:\Users\Alex.dnx\runtimes
1.0.0-beta5 clr x86 C:\Users\Alex.dnx\runtimes
1.0.0-beta5 coreclr x64 C:\Users\Alex.dnx\runtimes
1.0.0-beta5 coreclr x86 C:\Users\Alex.dnx\runtimes
1.0.0-rc1-update1 clr x64 C:\Users\Alex.dnx\runtimes
1.0.0-rc1-update1 clr x86 C:\Users\Alex.dnx\runtimes
1.0.0-rc1-update1 coreclr x64 C:\Users\Alex.dnx\runtimes
1.0.0-rc1-update1 coreclr x86 C:\Users\Alex.dnx\runtimes
* 1.0.0-rc1-update2 clr x86 C:\Users\Alex.dnx\runtimes default
1.0.0-rc1-update2 coreclr x86 C:\Users\Alex.dnx\runtimes
I want to compile it as coreclr linux....however when I run the dnu publish command above it says runtime doesn't exist even though I update coreclr from nuget?
Do I need to specify an OS (linux or windows) when I build it or will a single published app run on both if its coreclr?
This runs fine when imported into Azure but doesn't work when deployed to linux
OK, here's how to:
Install Visual Studio 2017 (with .NET Core)
Create your project, and get it to compile on Windows
Once it compiles and runs, make sure you can publish it from Visual Studio
Once you can publish it from Visual Studio, close Visual Studio and do the following
open cmd.exe (Windows-Key + R)
cd "directory of your .sln file"
dotnet restore -r ubuntu.16.04-x64
dotnet build -r ubuntu.16.04-x64
dotnet publish -f netcoreapp1.1 -c Release -r ubuntu.16.04-x64
Your application should now be in folder bin/publish
A list of RIDs (-r) can be obtained here and here.
If you want to develop on Linux, run
apt-get install dotnet-dev-1.0.1
and the dotnet-utility should run on Linux.
Note that if you get
C:\Program
Files\dotnet\sdk\1.0.0\Microsoft.Common.CurrentVersion.targets(2865,5):
error MSB3554: Cannot write to the output file "C:\path\to\your\project\obj\Debug\netcoreapp1.1\YOUR_APP.Properties.Resources.resources".
Positive number required.
Build FAILED.
when you run the build or publish command, just run the command again.
I have a project in qt-creator.
that computer have Qt: 4.8.2
one of the computers i want to run the application on have Qt: 4.6.2
I can see that qt-creator have an option under the project for QtVersions,
but i only got one option there "Qt 4.8.1 (System)"
Id like to have Qt 4.6.x as an option there too, how do i add/install that?
Target computer:
kde4-config --version
Qt: 4.6.2
KDE Development Platform: 4.4.2 (KDE 4.4.2)
kde4-config: 1.0
uname -a
Linux fw-01 2.6.32-24-generic #41-Ubuntu SMP Thu Aug 19 01:12:52 UTC 2010 i686 GNU/Linux
Build computer:
kde4-config --version
Qt: 4.8.2
KDE Development Platform: 4.8.5 (4.8.5)
kde4-config: 1.0
uname -a
Linux rito 3.3.8-gentoo #3 SMP Thu Sep 13 10:11:22 CEST 2012 i686 AMD Athlon(tm) II X2 245 Processor AuthenticAMD GNU/Linux
As the SDK doesn't support the old versions anymore, you will have to compile the libraries from source. The archive FTP site has the version you want.
Though I should point out that as long as you are linking dynamically and your code base doesn't use features post-v4.6.2 - then it will work as expected. If you are, then compiling using v4.6.2 headers isn't going to change anything - you will still have to upgrade the other computer or remove the newer Qt features from your application.
My workaround,
installing kubuntu 10.04 in a vitrualbox
copy the project to the virtualbox
compile it using qt-creator inside virtualbox
The binary made in the virtualbox works fine in both 4.6 and 4.8 envirement
In Qt Creator, try tools -> options -> Qt Versions (or Build/run, then qt versions, or some other abomination depending on what qt creator version you have).
Should see a list of Qt versions it knows about. Click add to reference your 4.6 qmake manually. That should get creator to pick it up.