Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
119 views
in Technique[技术] by (71.8m points)

c++ - C header files missing in Visual studio Command prompt to compile Sqlite3.c

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 Studio2017ProfessionalVCToolsMSVC14.16.27023includexmmintrin.h(79): fatal error C1083: Cannot open include file: 'malloc.h': No such file or directory

question from:https://stackoverflow.com/questions/65849805/c-header-files-missing-in-visual-studio-command-prompt-to-compile-sqlite3-c

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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 <headersmyheader.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 Kits10Lib10.0.17134.0ucrt

VC++ Doerctories->Library Directories: C:Program Files (x86)Windows Kits10Lib10.0.17134.0ucrtx86

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...