如何解决clang找不到的stdio.h?

时间:2019-07-09 09:08:42

标签: c

我正在尝试从命令行传递clang main.c -omain.o。错误是fatal error: stdio.h cannot be found

我安装了clang 7.1.0,还安装了Visual Studio Windows Desktop Express。

   #include <stdio.h>
   int main()
   {    
       printf("hello");
       return 0;
   }

我尝试过

"C:\\Program Files\\LLVM\\bin\\clang.exe" -cc1 -triple x86_64-pc-windows-msvc19.11.0 -emit-obj -mrelax-all -mincremental-linker-compatible -disable-free -disable-llvm-verifier -discard-value-names -main-file-name squareRoot.c -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -v -resource-dir "C:\\Program Files\\LLVM\\lib\\clang\\7.1.0" -internal-isystem "C:\\Program Files\\LLVM\\lib\\clang\\7.1.0\\include" -internal-isystem "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\WDExpress\\VC\\Tools\\MSVC\\14.16.27023\\include" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.17763.0\\ucrt" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.17763.0\\shared" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.17763.0\\um" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.17763.0\\winrt" -fdebug-compilation-dir "C:\\Users\\amith.ks\\Desktop" -ferror-limit 19 -fmessage-length 120 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.11 -fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o "C:\\Users\\amith.ks\\Desktop\\squareRoot.o" -x c squareRoot.c

它工作正常。

但是

clang main.c -omain.o -v

给出错误

clang version 7.1.0 (tags/RELEASE_710/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
 "C:\\Program Files\\LLVM\\bin\\clang.exe" -cc1 -triple x86_64-pc-windows-msvc19.11.0 -emit-obj -mrelax-all -mincremental-linker-compatible -disable-free -disable-llvm-verifier -discard-value-names -main-file-name main.c -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -v -resource-dir "C:\\Program Files\\LLVM\\lib\\clang\\7.1.0" -internal-isystem "C:\\Program Files\\LLVM\\lib\\clang\\7.1.0\\include" -internal-isystem "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\WDExpress\\VC\\Tools\\MSVC\\14.16.27023\\include" -fdebug-compilation-dir "C:\\Users\\amith.ks\\Desktop" -ferror-limit 19 -fmessage-length 168 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.11 -fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o "C:\\Users\\amith.ks\\AppData\\Local\\Temp\\main-6524ac.o" -x c main.c
clang -cc1 version 7.1.0 based upon LLVM 7.1.0 default target x86_64-pc-win32
#include "..." search starts here:
#include <...> search starts here:
 C:\Program Files\LLVM\lib\clang\7.1.0\include
 C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Tools\MSVC\14.16.27023\include
End of search list.
main.c:1:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^~~~~~~~~
1 error generated.

任何对此的解决方案,这样我就可以给出1行命令来执行它。 设置INCLUDE时我做错了吗?

0 个答案:

没有答案