WinRT auto generated template compiling error in Visual Studio 2017 - c++

I am new to c++/WinRT. I am trying to create a new blank project under c++/WinRT using Visual Studio Pro 2017. But it gives some compiling error:
1>------ Build started: Project: BlankApp2, Configuration: Debug Win32 ------
1>Windows.AI.MachineLearning.MachineLearningContract.winmd
1>C:\Program Files (x86)\Windows Kits\10\References\10.0.17763.0\Windows.AI.MachineLearning.MachineLearningContract\1.0.0.0\Windows.AI.MachineLearning.MachineLearningContract.winmd : warning C4335: Mac file format detected: please convert the source file to either DOS or UNIX format
1>C:\Program Files (x86)\Windows Kits\10\References\10.0.17763.0\Windows.AI.MachineLearning.MachineLearningContract\1.0.0.0\Windows.AI.MachineLearning.MachineLearningContract.winmd(1): fatal error C1004: unexpected end-of-file found
1>midlrt : command line error MIDL1003: error returned by the C preprocessor (2)
1>Done building project "BlankApp2.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I updated my Visual Studio 2017 to the latest version. I also used the latest WinRT. I could build a console application using the code in Kenny Kerr's command window sample code. But couldn't build the blank application created by the Visual Studio 2017 wizard. Any help is greatly appreciated.

Related

Unreal engine 4.26.2 source version errors when running

I'm trying to set up UE4.26.2 source version but haven't been successful. I have cloned the repo from github, ran Setup and GenerateProjectFiles without errors, set development editor and x64 in Visual studio 2019 and built it without errors but when I try to run the UE I always get the same two errors:
Build started...
1>------ Build started: Project: UE4, Configuration: Development_Editor x64 ------
1>Building UE4Editor and ShaderCompileWorker...
1>Using Visual Studio 2019 14.34.31937 toolchain (C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933) and Windows 10.0.20348.0 SDK (C:\Program Files (x86)\Windows Kits\10).
1>Building 2 actions with 16 processes...
1> [1/2] UE4Editor.exe
1>LINK : fatal error LNK1104: cannot open file 'D:\UE4.26.2\UnrealEngine-4.26.2-release\Engine\Binaries\Win64\UE4Editor.exe'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets(45,5): error MSB3073: The command "..\..\Build\BatchFiles\Build.bat -Target="UE4Editor Win64 Development" -Target="ShaderCompileWorker Win64 Development -Quiet" -WaitMutex -FromMsBuild" exited with code 6.
1>Done building project "UE4.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========
LNK1104 cannot open file 'D:\UE4.26.2\UnrealEngine-4.26.2-release\Engine\Binaries\Win64\UE4Editor.exe'
MSB3073 The command "....\Build\BatchFiles\Build.bat -Target="UE4Editor Win64 Development" -Target="ShaderCompileWorker Win64 Development -Quiet" -WaitMutex -FromMsBuild" exited with code 6.
I have tried various different combinations of VS components, I have installed .net Desktop dev, desktop dev with c++ and game dev with c++. I am using .NET Framework 4.8 SDK with all the previous 4.x targeting packs. I have tried deleting certain content from the Win64 folder and other files which I can't recall, but after I run the UE4 it always builds them again so the errors persist.
I solved the issue. My avast antivirus put the "UE4Editor.exe" into quarantine, then I restored it and compiled and voila, it works

Microsoft Visual Studio Community 2019: fatal error C1083: Cannot open include file: 'corecrt.h': No such file or directory

Just completed the fresh installation of Microsoft Visual Studio Community 2019 with no optional features,
tried running simple code with c++ console app project type:
#include <iostream>
using namespace std;
int main()
{
cout << "testing vs 2019" << endl;
return 0;
}
Getting below error:
1>------ Rebuild All started: Project: Project1, Configuration: Debug x64 ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(434,5): warning MSB8003: The WindowsSDKDir property is not defined. Some build tools may not be found.
1>Source.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include\crtdefs.h(10,10): fatal error C1083: Cannot open include file: 'corecrt.h': No such file or directory
1>Done building project "Project1.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
I suggest you should download and install the Windows 10 SDK in the VS2019 installer.
The selected version needs to be the same as the version set in the project.
install the universal CRT SDK - refer the article here Universal-crt

How to compile code for Windows XP in Visual Studio 2017

I was trying to compile a basic hello world program for Windows XP in Visual Studio 2017 on Windows 10. But it was giving some errors as showing in the image.
I already tried the steps mentioned in other Stack Overflow posts on this question, and changed the Platform tools "Visual Studio 2017 - Windows XP (v141_xp)" .
#include<iostream>
using namespace std;
int main() {
cout << "Hello world\n";
}
1>------ Build started: Project: WindowsProject1, Configuration: Debug Win32 ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Platforms\Win32\PlatformToolsets\v141_xp\Toolset.targets(39,5): warning MSB8051: Support for targeting Windows XP is deprecated and will not be present in future releases of Visual Studio. Please see https://go.microsoft.com/fwlink/?linkid=2023588 for more information.
1>stdafx.cpp
1>c:\program files (x86)\microsoft sdks\windows\v7.1a\include\objbase.h(239): error C2760: syntax error: unexpected token 'identifier', expected 'type specifier'
1>c:\program files (x86)\microsoft sdks\windows\v7.1a\include\gdiplusheaders.h(891): error C4596: 'EmfToWmfBits': illegal qualified name in member declaration
1>c:\program files (x86)\microsoft sdks\windows\v7.1a\include\gdiplusstringformat.h(220): error C4596: 'GetTrimming': illegal qualified name in member declaration
1>Done building project "WindowsProject1.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What you have encountered here are issues in the header files for the XP-Compatible SDK. The problem is actually quite arcane but, fortunately, relatively easy to deal with: you simply need to 'relax' the strictness of conformity checks the compiler uses...
To do this, right-click on your project in the Solution Explorer and select "Properties." On the invoked property-page, select the "C/C++" tab, and then the "Language" sub-tab. In the page then displayed, make sure you select "Conformance Mode" to "No". That should fix the issues.
Feel free to ask for further clarification and/or explanation.
You didn't say what template you started with, but I suspect that you have Conformance Mode (/permissive-) enabled. Go to Project -> Properties -> C/C++ -> Language and set Conformance Mode to "No".
The old Windows 7.1a SDK used to support Windows XP was never updated to be conformant with /permissive-.

LINK : fatal error LNK1104: cannot open file 'ucrtd.lib' in VS2017 RC

I keep getting an error when I build a C++ project in Visual Studio 2017 RC.
1>------ Build started: Project: test, Configuration: Debug x64 ------
1>Source.cpp
1>LINK : fatal error LNK1104: cannot open file 'ucrtd.lib'
1>Done building project "test.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
OS: Windows 8.1, Visual Studio 2017 Release Candidate
Here is my program:
int main()
{
}
I did not set the language to anything special
I searched my whole machine for the file., but could not find it.
I have installed Windows SDK 8.1
Update:
After the comment from #user1336087
I tried to install Windows SDK 10I get an error:
[14f0:0009][2016-11-23T09:22:20] Package 'Win10SDK_10.0.14393.33,version=10.0.14393.3300' failed to install. Command executed: "C:\ProgramData\Microsoft\VisualStudio\Packages\Win10SDK_10.0.14393.33,version=10.0.14393.3300\packages\Win10SDK\10.0.14393.33\sdksetup.exe" /features OptionId.WindowsSoftwareDevelopmentKit OptionId.WindowsSoftwareLogoToolkit OptionId.NetFxSoftwareDevelopmentKit /quiet /norestart, Return code: -2146889721, Details: The hash value is not correct.
A workaround seems to have been described here: link
But the workaround still fails, even when I uninstall all SDK and install again.
It works in the final version of Visual Studio 2017
This comment here helped me with the same error. It seems having old versions of the Windows SDK present can cause LINK to get confused. Deleting the old version I had fixed the problem.
https://community.intel.com/t5/Intel-Fortran-Compiler/LINK-fatal-error-LNK1104-cannot-open-file-ucrtd-lib-with-VS2015/td-p/1060422

Marmalade ErrorCode 4 while building mkb project

I've got a project from my teacher, that I should run in the Marmalade Hub. I've imported this project en tried to run it. At first I got an error with the error code 7.
error: Visual Studio 2013 Express Windows Desktop requested but not found instal
led.
FAILED (error code=7)
I've fixed this problem to change the C++ Development (IDE's and Compilers) from 'Visual studio Express 2013 Windows Desktop' to 'Visual Studio 2013' (see image below). I did this change, because I do have 'Visual Studio Proffesional 2013 for Windows Desktop' and not 'Visual Studio Express 2013 for Windows Desktop'. 'Visual Studio 2013 Proffesional 2013 for Windows Desktop' doesn't exist in the drop down.
I tried again to run the project (see image below) and I did get another error with the error code 4:
-- Visual Studio Output --
1>------ Build started: Project: minimal_marmalade_vc12, Configuration: x86 Debu
g Win32 ------
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/FORCE' specification
1>LINK : fatal error LNK1181: cannot open input file 'cgl_d.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
-- End Visual Studio Output --
error: build failed: '['C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\C
ommon7\\IDE\\devenv.exe', 'minimal_marmalade_vc12.sln', '/build', 'X86 Debug', '
/out', 'vs_output_11728.log']' (1)
FAILED (error code=4)
I hope you guys (or girls ;) ) can solve this problem. Thanks!
Maybe that your project uses the library Core Media Library. Check whether used somewhere in the code header file cgl.h If so, then reinstall Core Media Library Instalation instructions you find in this guide