Clang / LLVM 标头包含问题 (Ubuntu)
我正在努力在 Ubuntu 上安装 LLVM 和 clang,并尝试从这里编译一些教程代码 - http://www.cs.bgu.ac.il/~mirskyil/CsWiki/Blogs/Post_Mirskyil_4c83cc1f85da2
我在使用 g++ 编译时遇到了一些问题,我认为是事实上我没有正确安装某些东西(我对这个东西相当陌生)。
当我尝试执行此命令时 -
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`
我收到以下错误 -
/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.
我假设有关 __STDC_LIMIT_MACROS 的第一个错误是我没有在命令行中定义某些内容,但另一个错误与文件包含有关。代码似乎正在尝试查找不存在的“llvm/APT/APSInt.h”,我可以手动更改这些路径以使其工作,但似乎我做错了一些事情。
如果有人能指出我正确的方向,我将不胜感激!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将 tut.cpp 移至 cmdline 末尾即可完成。
Move tut.cpp to the end of cmdline and you're done.
我认为首先你应该尝试先用宏 __STDC_LIMIT_MACROS 来解决问题,
当我遇到这种类型的错误时,是因为我忘记了这一点:
您应该尝试查看此命令是否返回预期的结果:
例如。
I think that first you should try to solve the problem with the macro __STDC_LIMIT_MACROS first,
When I have this type of error, it 's because I have forgotten this :
You should try to see if this command return what expected:
For example.