C++ 在Visual Studio中尝试链接libclang时出现链接错误

C++ 在Visual Studio中尝试链接libclang时出现链接错误,c++,dll,linker,clang,visual-studio-2015,C++,Dll,Linker,Clang,Visual Studio 2015,我想做的是建立这个库: 一切都进行得很顺利,直到我找到了与libclang的链接,在这里发生了这种情况: 1>Cursor.obj : error LNK2001: unresolved external symbol __imp_clang_CXXMethod_isStatic 1>Cursor.obj : error LNK2001: unresolved external symbol __imp_clang_getCursorType 1>Cursor.obj : er

我想做的是建立这个库: 一切都进行得很顺利,直到我找到了与libclang的链接,在这里发生了这种情况:

1>Cursor.obj : error LNK2001: unresolved external symbol __imp_clang_CXXMethod_isStatic
1>Cursor.obj : error LNK2001: unresolved external symbol __imp_clang_getCursorType
1>Cursor.obj : error LNK2001: unresolved external symbol __imp_clang_Cursor_getMangling
1>Cursor.obj : error LNK2001: unresolved external symbol __imp_clang_getCXXAccessSpecifier
1>Cursor.obj : error LNK2001: unresolved external symbol __imp_clang_Cursor_getStorageClass
1>Cursor.obj : error LNK2001: unresolved external symbol __imp_clang_getCursorSpelling
1>Cursor.obj : error LNK2001: unresolved external symbol __imp_clang_visitChildren
1>Cursor.obj : error LNK2001: unresolved external symbol __imp_clang_getTypedefDeclUnderlyingType
1>Cursor.obj : error LNK2001: unresolved external symbol __imp_clang_getCursorDisplayName
1>Cursor.obj : error LNK2001: unresolved external symbol __imp_clang_CXXMethod_isConst
1>Cursor.obj : error LNK2001: unresolved external symbol __imp_clang_isCursorDefinition
1>Cursor.obj : error LNK2001: unresolved external symbol __imp_clang_getCursorLexicalParent
1>Cursor.obj : error LNK2001: unresolved external symbol __imp_clang_getCursorResultType
1>CursorType.obj : error LNK2001: unresolved external symbol __imp_clang_isConstQualifiedType
1>CursorType.obj : error LNK2001: unresolved external symbol __imp_clang_getNumArgTypes
1>CursorType.obj : error LNK2001: unresolved external symbol __imp_clang_getTypeDeclaration
1>CursorType.obj : error LNK2001: unresolved external symbol __imp_clang_getTypeSpelling
1>CursorType.obj : error LNK2001: unresolved external symbol __imp_clang_getArgType
1>CursorType.obj : error LNK2001: unresolved external symbol __imp_clang_getCanonicalType
1>MetaUtils.obj : error LNK2001: unresolved external symbol __imp_clang_disposeString
1>MetaUtils.obj : error LNK2001: unresolved external symbol __imp_clang_getCString
1>ReflectionParser.obj : error LNK2001: unresolved external symbol __imp_clang_getTranslationUnitCursor
1>ReflectionParser.obj : error LNK2001: unresolved external symbol __imp_clang_createTranslationUnitFromSourceFile
1>ReflectionParser.obj : error LNK2001: unresolved external symbol __imp_clang_createIndex
1>ReflectionParser.obj : error LNK2001: unresolved external symbol __imp_clang_disposeIndex
1>ReflectionParser.obj : error LNK2001: unresolved external symbol __imp_clang_disposeTranslationUnit
我正在构建64位版本,并且我已经在64位/版本模式下从源代码手动构建了llvm/clang。 我不知道这是否重要(?),但我使用的是github的clang主分支。考虑到一切都经过了链接阶段,我认为,主分支应该一切正常

我正在使用Visual Stduio 2015


在项目选项中,我添加了额外的库目录,以指向clang具有*.lib文件的位置。

除了在
链接器->其他库目录中指定它们的路径之外,您需要在属性对话框的
链接器->输入->附加依赖项
部分中明确登记要链接到的特定
.lib
文件

另外,再次检查lib文件的路径和版本是否正确(x86 vs x64)

在缺少lib文件的情况下,链接器无法将名称(符号)解析为其实现,因此出现
未解析符号
链接器错误

如果您有兴趣进一步了解,这里有一个很好的资源-