[cfe-dev] Clang / LLVM Header Include Issue

Laurence Herbert laurence.herbert1 at gmail.com
Mon Aug 15 08:01:54 PDT 2011


Hi,

I apologize if this is the wrong place to post this but I could do with some
assistance. I'm working on getting LLVM and clang installed with Ubuntu and
try to compile some tutorial code from here -
http://www.cs.bgu.ac.il/~mirskyil/CsWiki/Blogs/Post_Mirskyil_4c83cc1f85da2

I have been running into some problems when compiling using g++ and I would
assume it is to do with the fact I have not installed something correctly (I
am fairly new to this stuff).

When I attempt to execute this command -

g++ tut.cpp -g -o tut.out \
`$LLVM/Debug+Asserts/bin/llvm-config --cxxflags` \
-I$LLVM/tools/clang/include/ \
-lclangFrontendTool -lclangFrontend -lclangDriver -lclangSerialization \
-lclangCodeGen -lclangParse -lclangSema -lclangChecker -lclangAnalysis \
-lclangIndex -lclangRewrite -lclangAST -lclangLex -lclangBasic \
`$LLVM/Debug+Asserts/bin/llvm-config --ldflags --libs`

I receive the following errors -

/home/rob/llvm/include/llvm/Support/DataTypes.h:45:3: error: #error
"Must #define      __STDC_LIMIT_MACROS before #including
System/DataTypes.h"

/home/rob/llvm/include/llvm/Support/DataTypes.h:49:3: error: #error
"Must #define __STDC_CONSTANT_MACROS before " "#including
System/DataTypes.h"

In file included from /llvm/tools/clang/include/clang/AST/Decl.h:17:0,
                 from /llvm/tools/clang/include/clang/AST/ASTContext.h:23,
                 from tut.cpp:3:
/llvm/tools/clang/include/clang/AST/APValue.h:18:29: fatal error:
llvm/ADT/APSInt.h: No such file or directory
compilation terminated.

I assume the first error about __STDC_LIMIT_MACROS is I haven't defined
something in the command line, but the other error is to do with file
includes. It seems that the code is trying to look into 'llvm/APT/APSInt.h'
which does not exist, I can manually change these paths to work but it seems
like I have done something wrong.

If anyone can point me in the right direction it would be greatly
appreciated.

Thanks,

Laurence
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110815/5af40095/attachment.html>


More information about the cfe-dev mailing list