I have a UWP C++ project with links to external Dependencies, that have #includes to files that don't exist.
eg
This is actually the Cordova SQLite windows plugin, so not a project I created myself.
When I build, I get many errors...
Severity Code Description Project File Line Suppression State
Error (active) E1696 cannot open source file "wrl\client.h" SQLite3.UWP C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\agile.h 16
Error (active) E1696 cannot open source file "winapifamily.h" SQLite3.UWP C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt\corecrt.h 196
Error (active) E0020 identifier "IUnknown" is undefined SQLite3.UWP C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\agile.h 26
Error (active) E0020 identifier "HRESULT" is undefined SQLite3.UWP C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\agile.h 27
Error (active) E0145 variable "Platform::Details::GetProxyImpl" may not be initialized SQLite3.UWP C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\agile.h 27
Error (active) E0282 the global scope has no "IUnknown" SQLite3.UWP C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\agile.h 27
Error (active) E0029 expected an expression SQLite3.UWP C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\agile.h 27
Error (active) E0020 identifier "HRESULT" is undefined SQLite3.UWP C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\agile.h 28
Error (active) E0145 variable "Platform::Details::ReleaseInContextImpl" may not be initialized SQLite3.UWP C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\agile.h 28
Error (active) E0282 the global scope has no "IUnknown" SQLite3.UWP C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\agile.h 28
Error (active) E0029 expected an expression SQLite3.UWP C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\agile.h 28
Error (active) E0020 identifier "HRESULT" is undefined SQLite3.UWP C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\agile.h 31
Error (active) E0282 the global scope has no "IUnknown" SQLite3.UWP C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\agile.h 31
Error (active) E0020 identifier "HRESULT" is undefined SQLite3.UWP C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\agile.h 37
Error (active) E0282 the global scope has no "IUnknown" SQLite3.UWP C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\agile.h 37
Error (active) E0059 function call is not allowed in a constant expression SQLite3.UWP C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt\corecrt.h 197
Error C1083 Cannot open include file: 'winapifamily.h': No such file or directory SQLite3.UWP c:\program files (x86)\windows kits\10\include\10.0.15063.0\ucrt\corecrt.h 196
When I browse to where one of the files that does exist reside, explorer open up at C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt. This files has (for example) the following #include <winapifamily.h>, and this file does not exist in that folder.
However, if I search for this file in the root of the Window Kit folder, I do find it in other folders..
Going into the project properties, I see the following...
Finally drilling in more, I see...
So, the version it appears to be referencing is 10.0.15063.0, and this folder does NOT have some of the headers being referenced.
My question is, today (Sept 2019), on Windows 10, how do I defined this (and other ) include paths?
I have read many posts, but depending on the post date, you get different answers and none have helped in my case.
Update 1
Going into the project settings, I noticed that the Platform Toolset was set to v140.
I swapped this to v141 as below...
I now get less errors...
And the source folder for one of the files referencing the missing winapifamily.h is now C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt
Opening it, I can see that the winapifamily.h is still not there.
Where would there be a a collection of headers in such a toolkit that references missing files... I just can't understand this.
Update 2
I have removed and readded the plugin, and went from 3.2.0 to ^3.3.0"
The file referencing the winapifamily.h (corecrt.h) is located in C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt, and there is no winapifamily.h in this folder.
Platform toolkit in the UWP project is set to Visual Studio 2017 (v141)
I realised I did not have Windows 10 SDK (10.0.15063.0) installed. I went into Visual Studio installer and went into modify for Visual Studio 2017
After installing these (for desktop, UWP and C++), my project would finally build.
Related
I am using VS 2019 Professional.
File atlconv.h exists at
C:\Program Files (x86)\Microsoft Visual
Studio\2019\Professional\VC\Tools\MSVC\14.16.27023\atlmfc\include
However, there're two folders at
C:\Program Files (x86)\Microsoft Visual
Studio\2019\Professional\VC\Tools\MSVC\
14.16.27023 and 14.28.29333.
What paths does visual studio 2019 use when looking for atlconv.h?
Where can I find out about paths?
I'm trying to follow the instructions here to add PGO for my project. After I added the /GENPROFILE flag, I start getting the link error:
LINK : fatal error LNK1104: cannot open file 'pgort.lib'
After debugging it a bit, I believe the problem is that my Library Directories (found under VC++ Directories tab) has a value of $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64) which is evaluating to:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\lib\spectre\x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\atlmfc\lib\spectre\x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\VS\lib\x64
C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\VS\UnitTest\lib
C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64
C:\Program Files (x86)\Windows Kits\NETFXSDK\4.7.2\lib\um\x64
It looks like the .\spectre\x64 paths don't have the pgort.lib library, but the non-spectre path does:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\lib\x64
What do I do to fix this? I find it hard to believe that if I'm using the spectre binaries (which I am not even sure how/why I am in the first place) that I can't optimize my project.
BTW, I tried this on a machine with Enterprise VS installed and it's the same. So this isn't specific to Community edition.
I ended up updating my build configuration/scripts to dynamically update the LibraryPath to add the appropriate, architecture-specific version of $(VC_LibraryPath_VC_x64_Desktop) when compiling for PGO.
I have Visual Studio 2017 Community Edition; along with a bunch of SDKs:
> dir "C:\Program Files (x86)\Windows Kits\10\Include"
10.0.10150.0
10.0.10586.0
10.0.15063.0
10.0.17134.0
10.0.10240.0
10.0.14393.0
10.0.16299.0
10.0.17763.0
However, "Командная строка разработчика для VS 2017" (VsDevCmd.bat) doesn't see my SDK. Environment variables:
IFCPATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ifc\x86
INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include;
LIB=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\lib\x86;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x86;
LIBPATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\lib\x86;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x86;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x86\store\references;C:\Windows\Microsoft.NET\Framework\v4.0.30319;
resulting in
fatal error C1083: Не удается открыть файл включение: sys/types.h: No such file or directory
on compilation with cl.exe.
Are any additional steps needed to configure SDKs for Visual Studio 2017?
Quite unexpectedly, the problem was in
C:\Windows\System32
missing from PATH.
set VSCMD_DEBUG=3
helped to pin down the issue.
I have recently installed Visual Studio Community 2013 with update 4 and when I try to build my project I get these errors(see below):
C:\Program Files(x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(362,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry. TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1> main.cpp
1>c:\program files (x86)\microsoft sdks\windows\v7.1a\include\sal_supp.h(57): warning C4005: '__useHeader' : macro redefinition
1> C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\sal.h(2886) : see previous definition of '__useHeader'
1>c:\program files (x86)\microsoft sdks\windows\v7.1a\include\specstrings_supp.h(77): warning C4005: '__on_failure' : macro redefinition
1> C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\sal.h(2896) : see previous definition of '__on_failure'
How to solve them? I tried many ways but no luck.
Go to control panel and go to uninstall program.
Choose your visual studio community edition update 4. Select change or repair, if it's there. If it opens to the Visual Studio window then select repair there.
Select repair.
Keep your internet connection on while you do this, so your sdk and platform tools can be updated.
If this doesn't work, there are some links to altering the registry:
https://stackoverflow.com/a/24478856/3956566
https://social.msdn.microsoft.com/Forums/vstudio/en-US/48a4500c-2c48-43dd-822b-10e83258d18b/warning-msb8003-could-not-find-windowssdkdir-variable-from-the-registry-targetframeworkversion-or?forum=visualstudiogeneral
How to set SGEN toolpath in Msbuild to target 3.5 framework
https://code.google.com/p/gyp/issues/detail?id=457
When in VS2010 I add
#include <iostream>
to console aplication template I get many errors in type_traits
error C2275: '_Ty' : illegal use of this type as an expression c:\program files (x86)\microsoft visual studio 11.0\vc\include\type_traits 762 1 pcl1 (Visual Studio 2010)
error C3861: '__is_standard_layout': identifier not found c:\program files (x86)\microsoft visual studio 11.0\vc\include\type_traits 762 1 pcl1 (Visual Studio 2010)
error C2955: 'std::_Cat_base' : use of class template requires template argument list c:\program files (x86)\microsoft visual studio 11.0\vc\include\type_traits 763 1 pcl1 (Visual Studio 2010)
error C2275: '_Ty' : illegal use of this type as an expression c:\program files (x86)\microsoft visual studio 11.0\vc\include\type_traits 768 1 pcl1 (Visual Studio 2010)
an many others...
I don't know why why but I think it's somehow connected with the fact that I'm using both VS2012 and VS2010. How to fix it?
From the error message it is clear that your VS2010 project is somehow being directed to look in the VS2012 include directory, c:\program files (x86)\microsoft visual studio 11.0\vc\include. This is never a good idea.
Check your project settings under C/C++ / General / Additional Include Directories. Remove any references to compiler include directories. The correct directories for your compiler will be automatically located by the system.