2015-10-19 44 views
0

我想要做的就是建立這個庫:直到我反對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文件。

回答

2

除了在Linker ->additional library directories中指定其路徑之外,還需要在屬性對話框的Linker->Input->Additional Dependencies部分中明確列出要鏈接的特定.lib文件。

另外,再次檢查您是否擁有lib文件的正確路徑和版本(x86 vs x64)。

在缺少lib文件的情況下,鏈接程序無法將名稱(符號)解析爲其實現,因此unresolved symbol鏈接程序錯誤。

如果您有興趣進一步瞭解,這裏是一個很好的資源 - http://www.lurklurk.org/linkers/linkers.html

+1

哦,非常感謝你!有效。 –