我正在尝试使用visual c ++ 2010 express编译本教程中描述的源代码. http://kevinaboos.wordpress.com/2013/07/23/clang-tutorial-part-ii-libtooling-example/
完整的源代码就在这里. https://github.com/kevinaboos/LibToolingExample
我已使用此链接中提供的可执行文件来安装LLVM.由于格式问题,我无法发布完整的错误消息.但我会尽量提供尽可能多的信息.当我尝试构建解决方案时,我收到以下错误: -
argument unused during compilation warnings. C:\Program Files (x86)\LLVM\include\llvm/Support/Compiler.h(57,1): error : LLVM requires at least MSVC 2012. C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocnum(228,53): error : definition of dllimport static field not allowed C:\Program Files (x86)\LLVM\include\llvm/ADT/IntrusiveRefCntPtr.h(26,9): fatal error : 'atomic' file not found
我正在使用Windows-7 64位.我通过更改项目属性链接了头文件和库.我是构建c ++应用程序的新手.请帮忙.
如何从 clang 中的 FunctionDecl 类中以字符串形式获取参数信息。我正在尝试,但对这么多继承感到困惑。此外,他们的编译器说 getReturnType() 不是 FunctionDecl 的成员,但 doxygen 文档另有说明。请帮忙。 http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html
using namespace std;
using namespace clang;
using namespace clang::driver;
using namespace clang::tooling;
using namespace llvm;
.......
class ExampleVisitor : public RecursiveASTVisitor<ExampleVisitor>
{
......
virtual bool VisitFunctionDecl(FunctionDecl *func)
{
numFunctions++;
string funcName = func->getNameInfo().getName().getAsString();
string retName = func->getReturnType().getAsString();
...
return true;
}
}
Run Code Online (Sandbox Code Playgroud)
错误:-
“class clang::FunctionDecl”没有名为“getReturnType”的成员