0
votes

When i tried to compile sqlite3.c file from Visual studio 2017 developer command prompt(MSVC), i'm getting errors for missing C header files. I have selected all the options/Work loads in visual studio installer that are required for C & CPP development. Not sure what reference i'm missing. This is my sample input

cl shell.c sqlite3.c -Fesqlite3.exe

this is the response :

Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27042 for x86 Copyright (C) Microsoft Corporation. All rights reserved.

shell.c shell.c(85): fatal error C1083: Cannot open include file: 'stdlib.h': No such file or directory sqlite3.c C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\xmmintrin.h(79): fatal error C1083: Cannot open include file: 'malloc.h': No such file or directory

1
I think there is a problem with the default SDK - drescherjm

1 Answers

1
votes

According to Microsoft Docs, error C1083 is mainly caused by the following reasons.

The file is not included in the include search path

The compiler cannot find the file by using the search rules that are indicated by an #include or #import directive. For example, when a header file name is enclosed by quotation marks,

#include "myincludefile.h"

this tells the compiler to look for the file in the same directory that contains the source file first, and then look in other locations specified by the build environment. If the quotation marks contain an absolute path, the compiler only looks for the file at that location. If the quotation marks contain a relative path, the compiler looks for the file in the directory relative to the source directory.

If the name is enclosed by angle brackets,

#include <stdio.h>

the compiler follows a search path that is defined by the build environment, the /I compiler option, the /X compiler option, and the INCLUDE environment variable. For more information, including specific details about the search order used to find a file, see #include Directive (C/C++) and #import Directive.

If your include files are in another directory relative to your source directory, and you use a relative path in your include directives, you must use double quotes instead of angle brackets. For example, if your header file myheader.h is in a subdirectory of your project sources named headers, then this example fails to find the file and causes C1083:

#include <headers\myheader.h>

In my opinion, the reason is: stdio.h these header files are not located in the path is not in the default path of VS2017, resulting in VS2017 can not find these header files.

I suggest that you could add the following paths in Properties.

VC++ Doerctories->Include Directories: C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\ucrt

VC++ Doerctories->Library Directories: C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\ucrt\x86

If it still doesn't work, there may be a problem with the Windows SDK. I suggest that you could reinstall Windows SDK.