banach-space / clang-tutor

A collection of out-of-tree Clang plugins for teaching and learning
The Unlicense
659 stars 62 forks source link

Visual Studio compiler lib import problem #17

Closed Chordp closed 3 years ago

Chordp commented 3 years ago
1>HelloWorld.obj : error LNK2001: 无法解析的外部符号 "protected: virtual bool __cdecl clang::FrontendAction::shouldEraseOutputFiles(void)" (?shouldEraseOutputFiles@FrontendAction@clang@@MEAA_NXZ)
1>HelloWorld.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl clang::ASTFrontendAction::ExecuteAction(void)" (?ExecuteAction@ASTFrontendAction@clang@@MEAAXXZ)
1>HelloWorld.obj : error LNK2001: 无法解析的外部符号 "private: virtual void __cdecl clang::PluginASTAction::anchor(void)" (?anchor@PluginASTAction@clang@@EEAAXXZ)
1>HelloWorld.obj : error LNK2019: 无法解析的外部符号 "public: __cdecl clang::FrontendAction::FrontendAction(void)" (??0FrontendAction@clang@@QEAA@XZ),函数 "class std::unique_ptr<class FindNamedClassAction,struct std::default_delete<class FindNamedClassAction> > __cdecl std::make_unique<class FindNamedClassAction,0>(void)" (??$make_unique@VFindNamedClassAction@@$$V$0A@@std@@YA?AV?$unique_ptr@VFindNamedClassAction@@U?$default_delete@VFindNamedClassAction@@@std@@@0@XZ) 中引用了该符号
1>HelloWorld.obj : error LNK2019: 无法解析的外部符号 "public: virtual __cdecl clang::FrontendAction::~FrontendAction(void)" (??1FrontendAction@clang@@UEAA@XZ),函数 "public: virtual void * __cdecl FindNamedClassAction::`scalar deleting destructor'(unsigned int)" (??_GFindNamedClassAction@@UEAAPEAXI@Z) 中引用了该符号
1>HelloWorld.obj : error LNK2019: 无法解析的外部符号 "public: static void __cdecl llvm::Registry<class clang::PluginASTAction>::add_node(class llvm::Registry<class clang::PluginASTAction>::node *)" (?add_node@?$Registry@VPluginASTAction@clang@@@llvm@@SAXPEAVnode@12@@Z),函数 "void __cdecl `dynamic initializer for 'X''(void)" (??__EX@@YAXXZ) 中引用了该符号
1>clangAST.lib(OpenMPClause.obj) : error LNK2019: 无法解析的外部符号 "class llvm::StringRef __cdecl llvm::omp::getOpenMPDirectiveName(enum llvm::omp::Directive)" (?getOpenMPDirectiveName@omp@llvm@@YA?AVStringRef@2@W4Directive@12@@Z),函数 "public: void __cdecl clang::OMPClausePrinter::VisitOMPIfClause(class clang::OMPIfClause *)" (?VisitOMPIfClause@OMPClausePrinter@clang@@QEAAXPEAVOMPIfClause@2@@Z) 中引用了该符号
1>clangAST.lib(StmtPrinter.obj) : error LNK2001: 无法解析的外部符号 "class llvm::StringRef __cdecl llvm::omp::getOpenMPDirectiveName(enum llvm::omp::Directive)" (?getOpenMPDirectiveName@omp@llvm@@YA?AVStringRef@2@W4Directive@12@@Z)
1>clangAST.lib(OpenMPClause.obj) : error LNK2019: 无法解析的外部符号 "enum llvm::omp::TraitSet __cdecl llvm::omp::getOpenMPContextTraitSetForProperty(enum llvm::omp::TraitProperty)" (?getOpenMPContextTraitSetForProperty@omp@llvm@@YA?AW4TraitSet@12@W4TraitProperty@12@@Z),函数 "public: void __cdecl clang::OMPTraitInfo::getAsVariantMatchInfo(class clang::ASTContext &,struct llvm::omp::VariantMatchInfo &)const " (?getAsVariantMatchInfo@OMPTraitInfo@clang@@QEBAXAEAVASTContext@2@AEAUVariantMatchInfo@omp@llvm@@@Z) 中引用了该符号
1>clangAST.lib(OpenMPClause.obj) : error LNK2019: 无法解析的外部符号 "class llvm::StringRef __cdecl llvm::omp::getOpenMPContextTraitSetName(enum llvm::omp::TraitSet)" (?getOpenMPContextTraitSetName@omp@llvm@@YA?AVStringRef@2@W4TraitSet@12@@Z),函数 "public: void __cdecl clang::OMPTraitInfo::print(class llvm::raw_ostream &,struct clang::PrintingPolicy const &)const " (?print@OMPTraitInfo@clang@@QEBAXAEAVraw_ostream@llvm@@AEBUPrintingPolicy@2@@Z) 中引用了该符号
1>clangAST.lib(OpenMPClause.obj) : error LNK2019: 无法解析的外部符号 "class llvm::StringRef __cdecl llvm::omp::getOpenMPContextTraitSelectorName(enum llvm::omp::TraitSelector)" (?getOpenMPContextTraitSelectorName@omp@llvm@@YA?AVStringRef@2@W4TraitSelector@12@@Z),函数 "public: void __cdecl clang::OMPTraitInfo::print(class llvm::raw_ostream &,struct clang::PrintingPolicy const &)const " (?print@OMPTraitInfo@clang@@QEBAXAEAVraw_ostream@llvm@@AEBUPrintingPolicy@2@@Z) 中引用了该符号
1>clangAST.lib(OpenMPClause.obj) : error LNK2019: 无法解析的外部符号 "enum llvm::omp::TraitProperty __cdecl llvm::omp::getOpenMPContextTraitPropertyKind(enum llvm::omp::TraitSet,class llvm::StringRef)" (?getOpenMPContextTraitPropertyKind@omp@llvm@@YA?AW4TraitProperty@12@W4TraitSet@12@VStringRef@2@@Z),函数 "public: __cdecl clang::OMPTraitInfo::OMPTraitInfo(class llvm::StringRef)" (??0OMPTraitInfo@clang@@QEAA@VStringRef@llvm@@@Z) 中引用了该符号
1>clangAST.lib(OpenMPClause.obj) : error LNK2019: 无法解析的外部符号 "class llvm::StringRef __cdecl llvm::omp::getOpenMPContextTraitPropertyName(enum llvm::omp::TraitProperty)" (?getOpenMPContextTraitPropertyName@omp@llvm@@YA?AVStringRef@2@W4TraitProperty@12@@Z),函数 "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl clang::OMPTraitInfo::getMangledName(void)const " (?getMangledName@OMPTraitInfo@clang@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) 中引用了该符号
1>clangAST.lib(OpenMPClause.obj) : error LNK2019: 无法解析的外部符号 "bool __cdecl llvm::omp::isValidTraitSelectorForTraitSet(enum llvm::omp::TraitSelector,enum llvm::omp::TraitSet,bool &,bool &)" (?isValidTraitSelectorForTraitSet@omp@llvm@@YA_NW4TraitSelector@12@W4TraitSet@12@AEA_N2@Z),函数 "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl clang::OMPTraitInfo::getMangledName(void)const " (?getMangledName@OMPTraitInfo@clang@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) 中引用了该符号
1>clangAST.lib(StmtPrinter.obj) : error LNK2019: 无法解析的外部符号 "public: static class llvm::StringRef __cdecl clang::Lexer::getSourceText(class clang::CharSourceRange,class clang::SourceManager const &,class clang::LangOptions const &,bool *)" (?getSourceText@Lexer@clang@@SA?AVStringRef@llvm@@VCharSourceRange@2@AEBVSourceManager@2@AEBVLangOptions@2@PEA_N@Z),函数 "bool __cdecl printExprAsWritten(class llvm::raw_ostream &,class clang::Expr *,class clang::ASTContext const *)" (?printExprAsWritten@@YA_NAEAVraw_ostream@llvm@@PEAVExpr@clang@@PEBVASTContext@4@@Z) 中引用了该符号
1>clangAST.lib(Expr.obj) : error LNK2019: 无法解析的外部符号 "public: __cdecl clang::Lexer::Lexer(class clang::SourceLocation,class clang::LangOptions const &,char const *,char const *,char const *)" (??0Lexer@clang@@QEAA@VSourceLocation@1@AEBVLangOptions@1@PEBD22@Z),函数 "public: class clang::SourceLocation __cdecl clang::StringLiteral::getLocationOfByte(unsigned int,class clang::SourceManager const &,class clang::LangOptions const &,class clang::TargetInfo const &,unsigned int *,unsigned int *)const " (?getLocationOfByte@StringLiteral@clang@@QEBA?AVSourceLocation@2@IAEBVSourceManager@2@AEBVLangOptions@2@AEBVTargetInfo@2@PEAI3@Z) 中引用了该符号
1>clangAST.lib(Expr.obj) : error LNK2019: 无法解析的外部符号 "private: bool __cdecl clang::Lexer::Lex(class clang::Token &)" (?Lex@Lexer@clang@@AEAA_NAEAVToken@2@@Z),函数 "public: class clang::SourceLocation __cdecl clang::StringLiteral::getLocationOfByte(unsigned int,class clang::SourceManager const &,class clang::LangOptions const &,class clang::TargetInfo const &,unsigned int *,unsigned int *)const " (?getLocationOfByte@StringLiteral@clang@@QEBA?AVSourceLocation@2@IAEBVSourceManager@2@AEBVLangOptions@2@AEBVTargetInfo@2@PEAI3@Z) 中引用了该符号
1>clangAST.lib(Expr.obj) : error LNK2019: 无法解析的外部符号 "public: static unsigned int __cdecl clang::Lexer::getTokenPrefixLength(class clang::SourceLocation,unsigned int,class clang::SourceManager const &,class clang::LangOptions const &)" (?getTokenPrefixLength@Lexer@clang@@SAIVSourceLocation@2@IAEBVSourceManager@2@AEBVLangOptions@2@@Z),函数 "public: class clang::SourceLocation __cdecl clang::StringLiteral::getLocationOfByte(unsigned int,class clang::SourceManager const &,class clang::LangOptions const &,class clang::TargetInfo const &,unsigned int *,unsigned int *)const " (?getLocationOfByte@StringLiteral@clang@@QEBA?AVSourceLocation@2@IAEBVSourceManager@2@AEBVLangOptions@2@AEBVTargetInfo@2@PEAI3@Z) 中引用了该符号
1>clangAST.lib(Expr.obj) : error LNK2019: 无法解析的外部符号 "public: unsigned int __cdecl clang::StringLiteralParser::getOffsetOfStringByte(class clang::Token const &,unsigned int)const " (?getOffsetOfStringByte@StringLiteralParser@clang@@QEBAIAEBVToken@2@I@Z),函数 "public: class clang::SourceLocation __cdecl clang::StringLiteral::getLocationOfByte(unsigned int,class clang::SourceManager const &,class clang::LangOptions const &,class clang::TargetInfo const &,unsigned int *,unsigned int *)const " (?getLocationOfByte@StringLiteral@clang@@QEBA?AVSourceLocation@2@IAEBVSourceManager@2@AEBVLangOptions@2@AEBVTargetInfo@2@PEAI3@Z) 中引用了该符号
1>clangAST.lib(Expr.obj) : error LNK2019: 无法解析的外部符号 "private: void __cdecl clang::StringLiteralParser::init(class llvm::ArrayRef<class clang::Token>)" (?init@StringLiteralParser@clang@@AEAAXV?$ArrayRef@VToken@clang@@@llvm@@@Z),函数 "public: class clang::SourceLocation __cdecl clang::StringLiteral::getLocationOfByte(unsigned int,class clang::SourceManager const &,class clang::LangOptions const &,class clang::TargetInfo const &,unsigned int *,unsigned int *)const " (?getLocationOfByte@StringLiteral@clang@@QEBA?AVSourceLocation@2@IAEBVSourceManager@2@AEBVLangOptions@2@AEBVTargetInfo@2@PEAI3@Z) 中引用了该符号
1>clangAST.lib(TextNodeDumper.obj) : error LNK2019: 无法解析的外部符号 "class llvm::StringRef __cdecl llvm::omp::getOpenMPClauseName(enum llvm::omp::Clause)" (?getOpenMPClauseName@omp@llvm@@YA?AVStringRef@2@W4Clause@12@@Z),函数 "public: void __cdecl <lambda_9a749cc2600948731067c16499d3e43b>::operator()(void)const " (??R<lambda_9a749cc2600948731067c16499d3e43b>@@QEBAXXZ) 中引用了该符号
1>clangAST.lib(JSONNodeDumper.obj) : error LNK2019: 无法解析的外部符号 "public: static unsigned int __cdecl clang::Lexer::MeasureTokenLength(class clang::SourceLocation,class clang::SourceManager const &,class clang::LangOptions const &)" (?MeasureTokenLength@Lexer@clang@@SAIVSourceLocation@2@AEBVSourceManager@2@AEBVLangOptions@2@@Z),函数 "private: void __cdecl clang::JSONNodeDumper::writeBareSourceLocation(class clang::SourceLocation,bool)" (?writeBareSourceLocation@JSONNodeDumper@clang@@AEAAXVSourceLocation@2@_N@Z) 中引用了该符号
1>clangAST.lib(CommentSema.obj) : error LNK2019: 无法解析的外部符号 "public: class llvm::StringRef __cdecl clang::Preprocessor::getLastMacroWithSpelling(class clang::SourceLocation,class llvm::ArrayRef<class clang::TokenValue>)const " (?getLastMacroWithSpelling@Preprocessor@clang@@QEBA?AVStringRef@llvm@@VSourceLocation@2@V?$ArrayRef@VTokenValue@clang@@@4@@Z),函数 "public: void __cdecl clang::comments::Sema::checkDeprecatedCommand(class clang::comments::BlockCommandComment const *)" (?checkDeprecatedCommand@Sema@comments@clang@@QEAAXPEBVBlockCommandComment@23@@Z) 中引用了该符号
Chordp commented 3 years ago
if(NOT MSVC)
  # Allow undefined symbols in shared objects on Darwin (this is the default
  # behaviour on Linux)
  target_link_libraries(HelloWorld
        "$<$<PLATFORM_ID:Darwin>:-undefined dynamic_lookup>")
else()
  target_link_libraries(HelloWorld
    PRIVATE
    clangTooling
    clangFrontend
    clangSerialization
    clangRewrite
    clangASTMatchers
    clangAST
    clangBasic
    LLVMFrontendOpenMP
    LLVMSupport
    )
endif()
Chordp commented 3 years ago

error: unable to find plugin 'hello-world'

banach-space commented 3 years ago

Hi @Chordp ,

Thank you for using clang-tutor and for submitting this issue. Sadly, I have no access to a Windows machine and can neither reproduce nor help with this.

Also, LLVM/Clang plugins on Windows are not really supported (there's hardly any official documentation). Perhaps you could try in WSL instead?

banach-space commented 3 years ago

Closing as Windows is currently not supported. Thank you for posting this!