Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot open source file "sys/types.h" , "sys/stat.h"

I am using Visual Studio 2017. I just updated it and started to get this error on every project I have:

C++ cannot open source file "sys/types.h"
C++ cannot open source file "sys/stat.h"

Didn't find any similar questions so sorry if duplicated. The error is for this 2 lines in file wchar.h and the error code is E1969 for both errors, tried repairing but didn't work, any help would be appreciated!

#include <sys/stat.h>
#include <sys/types.h>
like image 692
Silviu Avatar asked Sep 12 '25 01:09

Silviu


1 Answers

I was getting this error when I opened a project made by someone else in an older version of Visual Studio. Here is how I solved it:

Go to Project > [Project name] Properties...

Click VC++ Directories

Select Include Directories then Click the drop-down arrow to the right and select Edit...

Click New Line icon (looks like new folder icon)

Click the ... to browse for a directory

Navigate to C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\ucrt (Note that you don't drill down into the sys folder)

Click Select Folder > Ok > Ok

Once I did that the error was gone along with related errors in the code.

like image 153
Ben Orona Avatar answered Sep 14 '25 15:09

Ben Orona