2016-08-15 1 views
2

clangからPrintFunctionNamesの例を構築しようとしています。致命的なエラーが発生しました: 'type_traits'ファイルが見つかりません#include <type_traits>、clangの例を構築中

[mac-osx:clang/examples/PrintFunctionNames] osx% clang++ -std=c++0x PrintFunctionNames.cpp 
In file included from PrintFunctionNames.cpp:15: 
In file included from /usr/local/include/clang/Frontend/FrontendPluginRegistry.h:13: 
In file included from /usr/local/include/clang/Frontend/FrontendAction.h:22: 
In file included from /usr/local/include/clang/Basic/LLVM.h:22: 
In file included from /usr/local/include/llvm/Support/Casting.h:19: 
/usr/local/include/llvm/Support/type_traits.h:17:10: fatal error: 'type_traits' file not found 
#include <type_traits> 

システム情報:

打ち鳴らすバージョン4.0.0(http://llvm.org/git/clang.git 6197d01def79876e2c1670ced871e10b12c36241)(http://llvm.org/git/llvm.git 24f7cd87f70ddcc91d50f77e405420c0c27853fd) ターゲット:x86_64版 - アップルdarwin15.6.0 スレッドモデル:POSIX は、しかし、私は次のエラーを取得します InstalledDir:は/ usr/local/binに

OSX 10.11.6

編集1:

アレックスが提案した変更を加えると、ヘッダーの問題が発生します。それを修正すると、同じエラーが再びスローされます。

% clang++ -std=c++0x PrintFunctionNames.cpp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -I../../../clang/include -I../../../../include -I../../../../../build/include 
In file included from PrintFunctionNames.cpp:15: 
In file included from ../../../clang/include/clang/Frontend/FrontendPluginRegistry.h:13: 
In file included from ../../../clang/include/clang/Frontend/FrontendAction.h:22: 
In file included from ../../../clang/include/clang/Basic/LLVM.h:22: 
In file included from ../../../../include/llvm/Support/Casting.h:19: 
../../../../include/llvm/Support/type_traits.h:17:10: fatal error: 'type_traits' file not found 
#include <type_traits> 
     ^
1 error generated. 
+0

'clang ++ -v -std = C++ 0x PrintFunctionNames.cpp'の出力を投稿することもできますか?今、私はisysrootが何の違いもないと思う。 – AlexDenisov

答えて

3

OS X(macOS)は少し違うアプローチをしています。いくつかのXcodeをインストールし、異なるプラットフォーム用にコンパイルすることができます。 ビルドするSDKに対して明示的に指定するには、-isysrootオプションを使用する必要があります。

次のコマンドは、トリックそうでない場合

clang++ -std=c++0x PrintFunctionNames.cpp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk 

を行うインストールされているSDKをチェックして、あなたのセットアップに対応してisysrootの値を変更してくださいする必要があります。

+1

提案された変更を行うと、コンパイルでヘッダーが見つからないというエラーがスローされ始める。それらを-Iで特に追加すると、type_traitの問題が再びスローされます。 @AlexDenisov、親切に編集1をチェックしてください。問題を説明することができますか? –

関連する問題