I installed clang with Visual Studio and then built the highlighted project as it\'s said in the documentation.
The build was successful, however when I try
Yes, I have an idea. Remove -cc1
or <stdio.h>
. According to the clang FAQ this is your error. It states quite explicitly, giving your precise example:
$ clang -cc1 hello.c hello.c:1:10: fatal error: 'stdio.h' file not found #include <stdio.h> ^ 1 error generated.
Reading on, it gives other alternative solutions, as well as a useful explanation, which you should certainly read in its entirety, since it's our job as programmers to read the manuals for the technology we use.
clang -cc1
is the frontend,clang
is the driver. The driver invokes the frontend with options appropriate for your system. To see these options, run:$ clang -### -c hello.c
Some
clang
command line options are driver-only options, some are frontend-only options. Frontend-only options are intended to be used only by clang developers. Users should not runclang -cc1
directly, because-cc1
options are not guaranteed to be stable.If you want to use a frontend-only option (“a
-cc1
option”), for example-ast-dump
, then you need to take theclang -cc1
line generated by the driver and add the option you need. Alternatively, you can runclang -Xclang <option> ...
to force the driver pass<option>
toclang -cc1
.
The emphasis is mine. This should give you enough guidance to get what you need done.