-1

When I starts a new project (Blank App (C++/WinRT)) on Windows10 1909 @ VS2019(up to date) its shows up a lot of errors as if the extension wasn't installed. But after trying to compile and run its works - so why do I get the errors and how can I solve this? screenshot


Edit: I have fond a solution for that. its turns out that the project was needed an additional include directory:

under the project properties->C/C++->General->[Additional Include Directory] I added the winRT folder: C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\cppwinrt screenshot2

and that's it now there's no errors (correction - after creating new project its still have the same errors)


edit2: Update: I installed the last windows 10 SDK and was still getting the seam errors. Than I installed a package via cmd with the following command: D:\vcpkg> vcpkg install cppwinrt:x86-windows

after this was done it seem to work now


edit3: I'm sorry for the annoying newcomer questions... its looks like I have another problem now with my project in the packages.config file is says that the package is not declared with the following warning packages.config pic

thanks for any help in advance.


(edit4) I followed this thread: nuget 'packages' element is not declared warning and that's it, now all I have to do is to learn how to code :D

1 Answers1

0

The 'standard' include paths for Visual C++ projects are the VC_IncludePath and WindowsSDK_IncludePath. The Windows SDK includes path already has all of the directories:

include\<10.0.build.0>\ucrt
include\<10.0.build.0>\shared
include\<10.0.build.0>\um
include\<10.0.build.0>\winrt
include\<10.0.build.0>\cppwinrt

"Blank App (C++/WinRT)" is not part of the standard VS 2019 template set. The name of the project in the screenshoot is "ConsoleApplication2", which would imply you created a Win32 console C++ project instead of a C++/WinRT project. Even still, you can reach the standard C++/WinRT headers from a Win32 console application since they are part of the standard path.

From the looks of the errors in your first screenshot, it appears you are using a generated C++/WinRT rather than the one in the Windows 10 SDK. With VS 2019, you must add the NuGet package Microsoft.Windows.CppWinRT to your project to get the MSBuild rules needed to build with the C++/WinRT VSIX installed, so that's likely a problem here. See VS Marketplace

Chuck Walbourn
  • 38,259
  • 2
  • 58
  • 81