Clang stdio,h file not found

后端 未结 1 1816
执念已碎
执念已碎 2021-01-12 20:45

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

相关标签:
1条回答
  • 2021-01-12 21:19

    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 run clang -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 the clang -cc1 line generated by the driver and add the option you need. Alternatively, you can run clang -Xclang <option> ... to force the driver pass <option> to clang -cc1.

    The emphasis is mine. This should give you enough guidance to get what you need done.

    0 讨论(0)
提交回复
热议问题