Problem building Clang in Eclipse

Hi,

I am trying to build Clang in Eclipse (Indigo) on Ubuntu. I am following the steps given at http://clang.llvm.org/get_started.html . I have done following:

  1. Checked out llvm from svn repository.
  2. Checked out Clang from svn repository under llvm/tools
  3. Created build directory at the top level directory so that it has two subdirectories, llvm and build.
  4. Used cmake and generator “Eclipse CDT4 - Unix Makefile” that created project files in build directory.
  5. Used eclipse to build project.

Eclipse builds the project (llvm) successfully as I receive no compilation or link errors and I see executables including “clang” in directory bin under build. However, when I open any source file, such as CFG.cpp, Eclipse shows numerous compilation errors related to unresolved symbols. I am wondering if I have missed something in the steps. Could you please help me?

Thanks,

Rahul

I see the same thing in the Windows version of Eclipse-CDT. I think this is because LLVM+clang relies heavily on TableGen generated files, which include #defines that the Eclipse just doesn't understand. Maybe setting the appropiate include dirs may solve some of them.

It would be awesome to hook up clang-index with eclipse but that's way beyond my capabilities.

-- Ed.

Hi Rahul,
First, open Project Properties and check C/C++ General -> Path and
Symbols, the "Source Location" tab. Make sure that "llvm" (the root of
the source) directory appears in the "Source folders on build path"
list.

Another option is to go to Window -> Preferences, C/C++, Code Analysis
and turn off "Syntax and semantic errors"

Csaba

Eclipse builds the project (llvm) successfully as I receive no
compilation or link errors and I see executables including "clang" in
directory bin under build. However, when I open any source file, such
as CFG.cpp, Eclipse shows numerous compilation errors related to
unresolved symbols. I am wondering if I have missed something in the
steps. Could you please help me?

I see the same thing in the Windows version of Eclipse-CDT. I think this
is because LLVM+clang relies heavily on TableGen generated files, which
include #defines that the Eclipse just doesn't understand. Maybe setting
the appropiate include dirs may solve some of them.

In that case, you would have to add the TableGen runs to the project as
custom build steps (I forget what they are called in Eclipse), so the generated
include files exist. Then point Eclipse to the correct directory, and it should
pick them up.

Hope that helps,
Jonathan

Thanks all who offered their suggestions.

I’m still working on this issue but may simply use vim eventually.

Rahul