Eclipse CDT - Cannot open include file: 'windows.h' (Microsoft SDK) - c++

I'm trying to get Eclipse to build a project which was originally designed using Visual C++ (version 2008). I'm using the Microsoft Visual C++ toolchain.
When I try to build the project, I get the following error:
C:\...\types.h(25) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
I've found some posts suggesting that I should download the Microsoft SDK and add the directory containing windows.h to the path. The problem is, Microsoft SDK (at least the version I downloaded, which is Windows SDK for Windows 8.1) does not contain such file.
Is there a way to obtain windows.h and all of its underlying headers (assuming that is the problem)? And if that's not the problem, what could be the solution?
Please notice I'm a real beginner to Eclipse and I have never used Visual, so I think there's no such thing as a too detailed answer.
If you need further information or did not understand something I wrote (English is not my mother tongue) please let me know.

Related

FLTK on Visual Studio 2019 x64, "Cannot open include file: 'dirent.h': No such file or directory

I am using the FLTK library in Visual Studio Community 2019 and building my application for x86 works fine. Now, I would like to build it for x64. However, I am getting the error "Cannot open include file: 'dirent.h': No such file or directory.".
The error occurs in the file, named 'filename.H'. This header file comes with the FLTK library.
Has anyone an idea how I could fix this problem?
Update:
The dirent.h library is not recognized, because its an C POSIX library, as described in the link here below. However, the question still remains, namely, how can I fix this problem?
<dirent.h> in visual studio 2010 or 2008
The link above refers to a link with an alternative dirent.h file. I've tried to include this file in my project, however, now another errors occur. These errors occur in the file Fl_Native_File_Chooser.H. The type specifiers fl_OPENFILENAMEW and fl_BROWSEINFOW are unknown in this file.
On Windows, dirent.h should not be included in the FLTK code. Even though it is 64 bit, WIN32 must be defined when using the FLTK libraries (https://www.fltk.org/doc-1.3/preface.html). Your problem will probably be solved if you define WIN32 at the beginning of your code or if you add WIN32 in your Visual Studio project properties - C/C++ - Preprocessor - Preprocessor Definitions, in x64 platform.
The way I would create an x64 solution is
Open ide\VisualC2010\fltk.sln
If you are using another version of Visual Studio, let it convert.
Change the solution configuration to Debug (somehow Visual Studio always defaults to Debug Cairo)
Click on solution platforms and select Configuration Manager
When the Configuration Manager appears, under Active solution platforms select New
When the next dialog appears, under type or select new platforms select x64
Click on the OKs etc to close the windows
Now change the solution platform to x64 and start the build.
You shouldn't get any dirent.h errors.

visual studio unable to find assert.h

I'm a first year at uni and I just got my new laptop. I downloaded Visual Studio 2017 and pulled my solution repo. However, I'm having some issues because it appears that a lot of the files I had on my previous computer were not downloaded in the installation of VS. My university wifi is slow and I don't want to re-download if I don't have to. I followed the previous steps I took to download VS 2017 on my old computer. Yet, I'm getting errors like:
cannot open source file "assert.h"
cannot open source file "errno.h"
cannot open source file "float.h"
cannot open source file "corecrt.h"
cannot open source file "stddef.h"
cannot open source file "stdio.h"
(among 20+ others)
If I right-click and choose the "Open document" on the line with the error, I get the message:
File '_______.h' not found in current source file's directory or in build system path
However, if I go to my include paths, I can find files like:
cassert.h
cerrno.h
ostream.h
but none of the ones that I'm told are missing.
Mainly, I'm wondering if there is a directory with this files I just need to add to the include directory or whether I just need to admit defeat and reinstall.
Thanks for the help, I welcome editing as I'm sure I've messed things up. I'm new to this.
Cheers,
Caleb
Using VS2017 I was able to resolve this same issue by:
Right click on solution
Selecting 'Retarget Solution'
Selecting an SDK from the Windows SDK Version dropdown
Clicking OK button
Your Visual Studio 2017 installation is probably missing the C packages (they are not automatically included with the Desktop development with C++ workload).
To install it, start the Visual Studio Installer, go to Individual components, and check Windows Universal C Runtime:
I think this component is also automatically marked for installation when adding the Linux development with C++ workload.
I solved the problem by uninstalling my original installation of Visual Studio (2019 version), then reinstalling and including the workload Desktop Development with C++.
In contrast to the above solutions, I did not need (and it did not help) to add the Windows Universal C Runtime.

can't setup openGL superBible examples due to problems finding Windows.h

I'm trying to compile the examples from the book OpenGL SuperBible 6th edition.
I got everything from their git repository and I'm trying to open it using Visual studio 2013 by opening the visual studio 2013 solution file that is included.
When I try building the main project inside "sb6_vs2013" It claims it can't find Windows.h : "Error 2 error C1083: Cannot open include file: 'windows.h': No such file or directory"
Now I tried to look at people's solutions on the internet and couldn't find anything helpful.
If I right click on the project and go to properties -> Configuration Properties - > VC directories I can see that it has the line:
$(WindowsSdkDir)\include
When I click on Macros I can see the path of WindowsSdkDir, its pointing to the right place where Windows SDK is, which in my case is: "C:\Program Files (x86)\Windows Kits\8.1" if I look at my file system in that folder and go to "\Include\um\" I can find Windows.h there, but for some reason visual studio 2013 fails to find it.
I thought it was due to bad installation and I even went as far as re-installing windows, visual studio and everything (it was time for that anyway) but nothing seems to fix this problem, even the new fresh installation didn't do the trick.
I'm not sure what else I can do to make this work.
Could someone help me solve this issue once and for all?
Eventually I managed to solved it, after the reinstall all the macros were correct I just need to check "inherit from parent on project defaults" checkbox and it did the trick

C++ Compiling Linking

I am currently getting into some DirectX Programming and just installed the DX-SDK. However, when I open the most basic sample File (Tutorial01, just displays a blue background) in Visual Studio (2012, but that seems to be irrelevant) and compile it I get a working output.
When I start an empty c++ project, make a new file called main.cpp and copy and paste the code from the tutorial, do the same with the resource.h file and also go to Project settings->Configuration Properties->Linker and copy the "Input" from the sample to my own project and then compile my project I get the following error output:
fatal error C1083: Cannot open include file: 'd3dx11.h': No such file or directory
The Header is included via #includein both, the sample and my project. However my project won't compile.
Your new project is missing VC++ Directories settings to find the DirectX SDK include/lib paths. Starting with VS 2010, you have to explicitly set up the include/lib paths to get the DirectX SDK integrated with Visual Studio.
Since you are trying to use VS 2012 with the legacy DirectX SDK, you should be aware that the VC++ Directories settings for VS 2010 are backwards from what you should be using with VS 2012/VS2013. This is because the Windows 8.x SDK includes newer versions of most of the DirectX headers in the now outdated and deprecated legacy DirectX SDK.
The further complication is that D3DX is not present in the Windows 8.x SDK and is itself deprecated. You can make it work per the instructions on MSDN, but keep in mind there are now alternatives to using D3DX for Direct3D 11 you should consider.

'dxerr9.h': No such file or directory

I am trying to compile a program I took off a cd from a book that uses directx to render 3d objects. when i press compile I get the following error
C1083: Cannot open include file: 'dxerr9.h': No such file or directory
I am using VC++ 2008 Express Edition and i am running off of Vista. I went to the following folder
[edit]
C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Include
I was able to find dxerr.h in the folder and the path is also being included in the VC++ Directories tab in the options window. dont know whats going on.
It seems your program was written using older version of DirectX SDK. The 'dxerr9.h' is present at least in "Microsoft DirectX 9.0 SDK (December 2004)", but is absent at least in "Microsoft DirectX SDK (August 2009)".
I think VitalyVal was right. about the following:
It seems your program was written using an older version of DirectX SDK. The 'dxerr9.h' is present at least in "Microsoft DirectX 9.0 SDK (December 2004)", but is absent at least in "Microsoft DirectX SDK (August 2009)".
I think the files now go by dxerr.h. I removed the 9 to the header and lib files and it worked.
That header was precisely duped in Aug2009 SDK, though that shouldn't surprise since it was already two years older DX versions had been deprecated, thus allowing for just a single library for everything.
By the way, people might be interested to check this post for a kind of more updated version.