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.
Related
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.
I am using Visual Studio 2012 (Update 5) with MS Window Kits 8.0 and .NET Framework 4.5.51209. Recently, I also installed MS Window Kits 8.1.
Now, I have a file: '\windows kits\8.0\include\shared\iprtrmib.h' that failes to include 'mprapidef.h'.
That include file only exists at: '\Windows Kits\8.1\Include\shared\mprapidef.h', which is not in my include path.
My Visual Studio 'Include Directories' is set to: "$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);".
These are my Visual Studio macros:
VCInstallDir: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\
WindowsSDK_IncludePath: C:\Program Files (x86)\Windows Kits\8.0\Include\um;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;C:\Program Files (x86)\Windows Kits\8.0\Include\winrt
When searching, I found a slightly similar question: missing header file on a new installation of visual studio 2012
I tried repairing my Visual Studio installation. I do not want to change the 'Include Directories' for each of my projects. What else should I try?
I installed vs2015 and vs2012, then the same problem occurs,however, I find a solution.
open visual studio project settings,click VC++ Directories, find Include Directories,add the following line to it.
C:\Program Files (x86)\Windows Kits\8.1\Include\shared
One may add the corresponding 8.1 paths to the environment variable.
Maybe it's necessary to do the same thing with the lib environment variable (WindowsSDK_LibraryPath_x86).
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
I thought they'd be in one of the files located in:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Packages\schemas\html
But I don't see them. I'm interested in adding my own directives to intellisense as well.
I found them here:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\Web\Schemas\1033\HTML
The file is called angular.xsd
After migrating a project from VS 2005 to VS 2010, we got the following errors related to include fils of Visual Studio, can anyone provide inputs on solving these? Thanks in advance.
1)
error C3861: '_beginthreadex': identifier not found c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\atlbase.h
_beginthreadex is defined in c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\process.h, even after including this file, the same error is coming.
2)
error C2664: 'ATL::ChTraitsOS::GetStringTypeExW' : cannot convert parameter 5 from 'unsigned __int64 *' to 'LPWORD' c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\atlstr.h
The following is definition of the function in the same file:
static BOOL GetStringTypeExW(
In LCID lcid,
In DWORD dwInfoType,
_In_count_(nLength) LPCWSTR pszSrc,
In int nLength,
Out LPWORD pwCharType)
As these errors are related to Visual studio include files, I have tried changing project related settings, but nothing is working and the errors are still existing.