2016-01-27 11 views
5

パスを書き込むときに、少なくともEclipse内からのビルドパスが不可能であってもIntellisenseを利用できるようにEclipse(またはCodeblock)を設定したい)。 アップデート:私は(詳細は下記)Eclipse CDTまたはコードブロックを設定してLLVM IRインテリジェンスを取得する

は、これまでのところ、私はシンプルなC++プログラムをコンパイルするために打ち鳴らすを使用するようにEclipseを設定しているEclipseで解析に基づく提案を有効にしたら、私は、少なくともいくつかのインテリセンスを取得しています。

はLLVMパスのためのインテリセンスを取得するには、私はから/usr/local/includeディレクトリが含まれています追加し、コードを試してみました:

#include <iostream> 
#include <llvm/IR/Function.h> 

using namespace std: 
int main() { 
    cout << "Hello World" << endl; 
    return 0; 
} 

それは#include <llvm/IR/Function.h>自体に失敗しない(すなわち、それは、このヘッダファイルを見つけることができますが)が、時にそれ以降のファイルも含めて

/usr/local/include/llvm/Support/DataTypes.h:58:3: error: "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h" 

どのようにすれば、私には少なくともインテリセンスを与えることができますか?

完全なログ

01:22:48 **** Rebuild of configuration Debug for project HelloWorld2 **** 
Info: Internal Builder is used for build 
clang++ -I/usr/local/include -O0 -emit-llvm -g3 -Wall -c -fmessage-length=0 -o src/HelloWorld2.bc ../src/HelloWorld2.cpp 
In file included from ../src/HelloWorld2.cpp:10: 
In file included from /usr/local/include/llvm/IR/Function.h:22: 
In file included from /usr/local/include/llvm/IR/Argument.h:17: 
In file included from /usr/local/include/llvm/ADT/Twine.h:14: 
/usr/local/include/llvm/Support/DataTypes.h:58:3: error: "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h" 
# error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h" 
^
/usr/local/include/llvm/Support/DataTypes.h:62:3: error: "Must #define __STDC_CONSTANT_MACROS before "   "#including Support/DataTypes.h" 
# error "Must #define __STDC_CONSTANT_MACROS before " \ 
^
In file included from ../src/HelloWorld2.cpp:10: 
In file included from /usr/local/include/llvm/IR/Function.h:22: 
In file included from /usr/local/include/llvm/IR/Argument.h:19: 
In file included from /usr/local/include/llvm/IR/Attributes.h:19: 
In file included from /usr/local/include/llvm/ADT/ArrayRef.h:14: 
In file included from /usr/local/include/llvm/ADT/SmallVector.h:20: 
/usr/local/include/llvm/Support/MathExtras.h:273:24: error: use of undeclared identifier 'INT64_C' 
    return N >= 64 || (-(INT64_C(1)<<(N-1)) <= x && x < (INT64_C(1)<<(N-1))); 
        ^
/usr/local/include/llvm/Support/MathExtras.h:273:56: error: use of undeclared identifier 'INT64_C' 
    return N >= 64 || (-(INT64_C(1)<<(N-1)) <= x && x < (INT64_C(1)<<(N-1))); 
                ^
/usr/local/include/llvm/Support/MathExtras.h:299:26: error: use of undeclared identifier 'UINT64_C' 
    return N >= 64 || x < (UINT64_C(1)<<(N)); 
         ^
/usr/local/include/llvm/Support/MathExtras.h:331:24: error: use of undeclared identifier 'INT64_C' 
    return N >= 64 || (-(INT64_C(1)<<(N-1)) <= x && x < (INT64_C(1)<<(N-1))); 
        ^
/usr/local/include/llvm/Support/MathExtras.h:331:56: error: use of undeclared identifier 'INT64_C' 
    return N >= 64 || (-(INT64_C(1)<<(N-1)) <= x && x < (INT64_C(1)<<(N-1))); 
                ^
In file included from ../src/HelloWorld2.cpp:10: 
In file included from /usr/local/include/llvm/IR/Function.h:22: 
In file included from /usr/local/include/llvm/IR/Argument.h:19: 
In file included from /usr/local/include/llvm/IR/Attributes.h:19: 
In file included from /usr/local/include/llvm/ADT/ArrayRef.h:14: 
/usr/local/include/llvm/ADT/SmallVector.h:232:20: warning: rvalue references are a C++11 extension [-Wc++11-extensions] 
    void push_back(T &&Elt) { 
       ^
/usr/local/include/llvm/ADT/SmallVector.h:476:33: warning: rvalue references are a C++11 extension [-Wc++11-extensions] 
    iterator insert(iterator I, T &&Elt) { 
           ^
/usr/local/include/llvm/ADT/SmallVector.h:645:46: warning: rvalue references are a C++11 extension [-Wc++11-extensions] 
    SmallVectorImpl &operator=(SmallVectorImpl &&RHS); 
              ^
/usr/local/include/llvm/ADT/SmallVector.h:383:12: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions] 
     for (auto I = this->end(), E = this->begin() + N; I != E; ++I) 
     ^
/usr/local/include/llvm/ADT/SmallVector.h:764:70: warning: rvalue references are a C++11 extension [-Wc++11-extensions] 
SmallVectorImpl<T> &SmallVectorImpl<T>::operator=(SmallVectorImpl<T> &&RHS) { 
                    ^
/usr/local/include/llvm/ADT/SmallVector.h:878:27: warning: rvalue references are a C++11 extension [-Wc++11-extensions] 
    SmallVector(SmallVector &&RHS) : SmallVectorImpl<T>(N) { 
         ^
/usr/local/include/llvm/ADT/SmallVector.h:883:44: warning: rvalue references are a C++11 extension [-Wc++11-extensions] 
    const SmallVector &operator=(SmallVector &&RHS) { 
             ^
In file included from ../src/HelloWorld2.cpp:10: 
In file included from /usr/local/include/llvm/IR/Function.h:22: 
In file included from /usr/local/include/llvm/IR/Argument.h:19: 
In file included from /usr/local/include/llvm/IR/Attributes.h:20: 
In file included from /usr/local/include/llvm/ADT/FoldingSet.h:21: 
/usr/local/include/llvm/Support/Allocator.h:134:70: error: expected expression 
      BumpPtrAllocatorImpl<AllocatorT, SlabSize, SizeThreshold>> { 
                    ^
/usr/local/include/llvm/Support/Allocator.h:346:2: error: expected a type 
}; 
^ 
/usr/local/include/llvm/Support/Allocator.h:346:2: error: expected class name 
/usr/local/include/llvm/Support/Allocator.h:346:2: error: expected '{' after base class list 
/usr/local/include/llvm/Support/Allocator.h:362:53: warning: rvalue references are a C++11 extension [-Wc++11-extensions] 
    SpecificBumpPtrAllocator(SpecificBumpPtrAllocator &&Old) 
                ^
/usr/local/include/llvm/Support/Allocator.h:366:64: warning: rvalue references are a C++11 extension [-Wc++11-extensions] 
    SpecificBumpPtrAllocator &operator=(SpecificBumpPtrAllocator &&RHS) { 
                  ^
/usr/local/include/llvm/Support/Allocator.h:375:5: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions] 
    auto DestroyElements = [](char *Begin, char *End) { 
    ^
/usr/local/include/llvm/Support/Allocator.h:375:28: error: expected expression 
    auto DestroyElements = [](char *Begin, char *End) { 
         ^
/usr/local/include/llvm/Support/Allocator.h:381:10: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions] 
    for (auto I = Allocator.Slabs.begin(), E = Allocator.Slabs.end(); I != E; 
     ^
/usr/local/include/llvm/Support/Allocator.h:381:29: error: no member named 'Slabs' in 'llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096, 4096>' 
    for (auto I = Allocator.Slabs.begin(), E = Allocator.Slabs.end(); I != E; 
        ~~~~~~~~~^
/usr/local/include/llvm/Support/Allocator.h:381:58: error: no member named 'Slabs' in 'llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096, 4096>' 
    for (auto I = Allocator.Slabs.begin(), E = Allocator.Slabs.end(); I != E; 
               ~~~~~~~~~^
/usr/local/include/llvm/Support/Allocator.h:383:52: error: no member named 'computeSlabSize' in 'llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096, 4096>' 
     size_t AllocatedSlabSize = BumpPtrAllocator::computeSlabSize(
           ~~~~~~~~~~~~~~~~~~^ 
/usr/local/include/llvm/Support/Allocator.h:384:35: error: no member named 'Slabs' in 'llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096, 4096>' 
      std::distance(Allocator.Slabs.begin(), I)); 
         ~~~~~~~~~^
/usr/local/include/llvm/Support/Allocator.h:386:35: error: no member named 'Slabs' in 'llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096, 4096>' 
     char *End = *I == Allocator.Slabs.back() ? Allocator.CurPtr 
         ~~~~~~~~~^
/usr/local/include/llvm/Support/Allocator.h:386:60: error: no member named 'CurPtr' in 'llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096, 4096>' 
     char *End = *I == Allocator.Slabs.back() ? Allocator.CurPtr 
               ~~~~~~~~~^
/usr/local/include/llvm/Support/Allocator.h:392:10: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions] 
    for (auto &PtrAndSize : Allocator.CustomSizedSlabs) { 
     ^
/usr/local/include/llvm/Support/Allocator.h:392:39: error: no member named 'CustomSizedSlabs' in 'llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096, 4096>' 
    for (auto &PtrAndSize : Allocator.CustomSizedSlabs) { 
          ~~~~~~~~~^
/usr/local/include/llvm/Support/Allocator.h:392:27: warning: range-based for loop is a C++11 extension [-Wc++11-extensions] 
    for (auto &PtrAndSize : Allocator.CustomSizedSlabs) { 
         ^
fatal error: too many errors emitted, stopping now [-ferror-limit=] 
13 warnings and 20 errors generated. 

01:22:50 Build Finished (took 1s.509ms) 

UPDATE: Eclipseはインテリセンス(それの少なくとも一部を)私を与えるん、私はウィンドウで解析に基づく提案をチェックしなければならなかった - >設定 - > C/C++ - >エディタ - >コンテンツアシスト - >詳細(デフォルトではチェックされていませんでした)

答えて

1

これは直接質問に答えるものではありませんが、正しく動作するビルド環境があることを確認します。これはコードブロックに固有です。

まず、チェックアウト(直接guide入門から取られた)LLVMのソースツリー:

git clone http://llvm.org/git/llvm.git 
cd llvm/tools 
git clone http://llvm.org/git/clang.git 
cd .. 
cd projects 
git clone http://llvm.org/git/compiler-rt.git 
git clone http://llvm.org/git/libcxx.git 
git clone http://llvm.org/git/libcxxabi.git 
git clone http://llvm.org/git/test-suite.git 
git clone http://llvm.org/git/openmp.git 

はあなたが好きではないものを削除します。

は、次にLLVMディレクトリ以外のディレクトリを作成します。

cd .. 
mkdir build 
は、ディレクトリ(CD)そこまでを変更し、実行

cd build 
cmake -g "CodeBlocks - Unix Makefiles" <your configure options> ../llvm 

をLLVM共有にルートパスを想定すると、そうでない場合は変更../llvm行を正しいパスに置き換えます。次に、code :: blocks内の既存のプロジェクトとして開きます。

すべてうまくいけば、ビルド環境が正しくセットアップされ、コード補完が機能するはずです。

+0

@ edgar-klerksありがとう、直接質問に答えることはできませんが、それは関連する問題を解決します、私はそれを受け入れています。 – ishaq

関連する問題