【发布时间】:2014-03-18 13:15:21
【问题描述】:
我正在尝试使用 libclang 解析库,但我遇到了一个非常简单的问题:如何使用 STL 对其进行配置?
目前,它无法解析翻译单元,因为它找不到<string>。
这是我尝试过的:
char *args[] = {"-x", "c++", "-Ic:/my/library/includes", "-IG:/Prog/libcxx-3.4/include"};
clang_parseTranslationUnit(index, "c:/my/library/test.cpp", args, 4, 0, 0, 0);
我在 Windows 上,从 llvm.org 下载了预编译的 clang 二进制文件,我尝试了各种 STL 实现:
- 视觉工作室
- 明文
- libCXX
在每种情况下,我都得到了未知类型。
例如,使用 mingw,我收到以下错误消息:
/mingw/include\wchar.h:221:71: error: unknown type name '_locale_t'
/mingw/include\wchar.h:223:81: error: unknown type name '_locale_t'
/mingw/include\stdlib.h:173:65: error: unknown type name '_locale_t'
/mingw/include\stdlib.h:175:75: error: unknown type name '_locale_t'
/mingw/include\io.h:301:14: error: unknown type name 'off64_t'
/mingw/include\io.h:301:36: error: C++ requires a type specifier for all declarations
/mingw/include\io.h:302:14: error: unknown type name 'off64_t'
/mingw/include\io.h:302:39: error: unknown type name 'off64_t'
/mingw/include\unistd.h:65:20: error: unknown type name 'off_t'
我发现的关于这个主题的罕见教程没有谈论这个主题......
【问题讨论】:
-
请问您是如何设法包含和链接 libclang 的?
标签: c++ windows stl mingw libclang