我剛剛學習關於How to write RecursiveASTVisitor based ASTFrontendActions的clang工具。 我遵循文檔中的示例並編譯示例代碼,並且總是有一個錯誤。我不知道爲什麼它有這個錯誤以及如何解決它。我沒有找到相關問題的解決方案。我不知道是否遇到同樣的問題並解決問題。編譯Clang工具時出錯遞歸ASTVisitor:錯誤:衝突返回類型CreateASTConsumer
/home/sun/project/clang-llvm/llvm/tools/clang/tools/extra/find-class-decls/FindClassDecls.cpp:44:31:error:衝突返回類型指定爲'虛擬鏗鏘: :ASTConsumer * FindNamedClassAction :: CreateASTConsumer(clang :: CompilerInstance &,llvm :: StringRef)' 從/ home/sun/project/clang-llvm/llvm/tools/clang/tools/extra/find-class- decls/FindClassDecls.cpp:4:0: /home/sun/project/clang-llvm/llvm/tools/clang/include/clang/Frontend/FrontendAction.h:64:40:error:overriding'virtual std :: unique_ptr clang :: FrontendAction :: CreateASTConsumer(clang :: CompilerInstance &,llvm :: StringRef)' ninja:build stopped:子命令失敗。
謝謝!
嗨尼克,根據你的答案,我改變了代碼,仍然存在一個錯誤,不能轉換'((&(&Compiler) - > clang :: CompilerInstance :: (FindNamedClassConsumer *)) - > FindNamedClassConsumer :: FindNamedClassConsumer(),((FindNamedClassConsumer *)))))'從'FindNamedClassConsumer *'到'std :: unique_ptr' 。 – sun 2014-10-21 15:58:49