试图在Visual Studio链接libclang当链接错误
问题描述:
我想要做的就是建立这个库:直到我反对libclang联 https://github.com/AustinBrunkhorst/CPP-Reflection 一切都进展顺利,其中发生这种情况:试图在Visual Studio链接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年
在项目选择我已经添加附加库目录,以点铿锵有* .lib文件。
答
除了在Linker ->additional library directories
中指定其路径之外,还需要在属性对话框的Linker->Input->Additional Dependencies
部分中明确列出要链接的特定.lib
文件。
另外,再次检查您是否拥有lib文件的正确路径和版本(x86 vs x64)。
在缺少lib文件的情况下,链接程序无法将名称(符号)解析为其实现,因此unresolved symbol
链接程序错误。
如果您有兴趣进一步了解,这里是一个很好的资源 - http://www.lurklurk.org/linkers/linkers.html
哦,非常感谢你!有效。 –