Windowsでclangを使用して簡単なhello worldの例をコンパイルしようとしましたが、以下のコマンドが可能なヘッダーを含む場所を表示する理由がわかりません。コマンドとしてWindowsのclangがヘッダーを見つけることができません
C:\Users\peter\Downloads>clang-cl -v hello.c
clang version 3.9.1 (branches/release_39)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Users\peter\scoop\apps\llvm\current\bin
"C:\\Users\\peter\\scoop\\apps\\llvm\\current\\bin\\clang-cl.exe" -cc1 -triple x86_64-pc-windows-msvc19.0.24215 -emit-obj -mrelax-all mincremental-linker-compatible -disable-free -disable-llvm-verifier -discard-value-names -main-file-name hello.c -mrelocation-model pic -pic-level 2 -mthread-model posix -relaxed-aliasing -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -D_MT -flto-visibility-public-std --dependent-lib=libcmt --dependent-lib=oldnames -stack-protector 2 -fms-volatile -fdiagnostics-format msvc -momit-leaf-frame-pointer -v -dwarf-column-info -debugger-tuning=gdb -resource-dir "C:\\Users\\peter\\scoop\\apps\\llvm\\current\\bin\\..\\lib\\clang\\3.9.1" -internal-isystem "C:\\Users\\peter\\scoop\\apps\\llvm\\current\\bin\\..\\lib\\clang\\3.9.1\\include" -internal-isystem "F:\\visualstudio2015\\VC\\include" -internal-isystem "C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v8.1A\\" -internal-isystem "C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v8.1A\\" -internal-isystem "C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v8.1A\\" -fdebug-compilation-dir "C:\\Users\\peter\\Downloads" -ferror-limit 19 -fmessage-length 120 -fms-extensions -fms-compatibility -fms-compatibility-version=19.0.24215 -fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o "C:\\Users\\peter\\AppData\\Local\\Temp\\hello-8512ad.obj" -x c hello.c
clang -cc1 version 3.9.1 based upon LLVM 3.9.1 default target x86_64-pc-windows-msvc
ignoring duplicate directory "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A"
ignoring duplicate directory "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A"
#include "..." search starts here:
#include <...> search starts here:
C:\Users\peter\scoop\apps\llvm\current\bin\..\lib\clang\3.9.1\include
F:\visualstudio2015\VC\include
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A
End of search list.
hello.c(3,10): fatal error: 'stdio.h' file not found
#include <stdio.h>
^
1 error generated.
C:\Users\peter\Downloads>
私はスクープ例えばhttp://scoop.sh/からLLVMをインストールし、単にclang.exeを呼び出すことにより、コードをコンパイルするためにしようと試みを示しています。
私はclang on Windows - incorrect header file path
を見ていたと私はという名前の環境変数を持っている「VS2015 x64のネイティブの内側から打ち鳴らすを実行している私のユーザー環境変数または私のシステム環境変数
のいずれかに含めるいけないことを確認することができますツールのコマンドプロンプト "のショートカットが動作するようです(ダウンロードディレクトリから" clang hello.c "を実行しただけに基づいています)。しかし、ショートカットが現在実行中のcmdプロンプトにどのような変更を加えるのですか?
私は彼らがあまりにも重いことを信じているので、私はcygwinの/ MSYS/mingwのを使用していない理由は、両方の賢明なディスク容量、および賢明な複雑さも
clang-clは、ランタイムライブラリヘッダーの場所を特定するため(および-fms-compatibility-versionの既定値を決定するため)、Visual Studioのインストールを検出するいくつかの方法を試します。あなたのVSが非標準の場所にインストールされていて、環境にVCINSTALLDIRが設定されているか、PATHにcl.exeの場所があるかのような通常の手がかりが見つからない場合、それを見つけることができません。 vcvarsall.batを使用すると、環境に十分な情報があることを確認する優れた方法です。 –
私は主にlinux/osxでの開発を行っていたので、これを書いている時点ではうまくいきませんでしたが、これはとにかく助けになりました。 –