Clang Tool (libtooling): set header search path to standard libs headers. Foundation framework(Clang 工具 (libtooling):将标头搜索路径设置为标准库标头.基础框架)
问题描述
related link http://kevinaboos.wordpress.com/2013/07/23/clang-tutorial-part-ii-libtooling-example
I'am using CommonOptionsParser to parse arguments for clang tool:
// parse the command-line args passed to your code
CommonOptionsParser op(argc, argv);
// create a new Clang Tool instance (a LibTooling environment)
ClangTool Tool(op.getCompilations(), op.getSourcePathList());
// run the Clang Tool, creating a new FrontendAction (explained below)
int result = Tool.run(newFrontendActionFactory<SomeAction>());
and next parameters:
llvm/Debug+Asserts/bin/mytool /somePath/someSource.mm --
When I run my tool (based on clang libtooling) on some source file, tool tries find included files, f.e:
#import "SomeClass.h", or #import<Foundation/Foundation.h>
And if it cannot find headers, it generates errors:
fatal error: ‘Foundation/Foundation.h’ file not found.
Could you tell me, if you know, how can I direct tool to the standard frameworks? And How can I direct it to the some header search path? How can I set headers search path when running tool?
I've solved the issue. you can add path to framework with options
-Iinclude -Ipath_for_foundation/Headers
after --
llvm/Debug+Asserts/bin/mytool /somePath/someSource.mm -- -Iinclude -Ipath_for_foundation/Headers
BUT, standard frameworks usually included with name of framework as prefixes
#import <Foundation/Foundation.h>
frameworks sources are placed in the folder called Headers, so clang cannot find them.
So, i'am going to find solution for that issue.
UPDATE:
solution
llvm/Debug+Asserts/bin/mytool /somePath/someSource.mm -- -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/System/Library/Frameworks/
这篇关于Clang 工具 (libtooling):将标头搜索路径设置为标准库标头.基础框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Clang 工具 (libtooling):将标头搜索路径设置为标准库标头.基础框架
基础教程推荐
- C++实现ETW进行进程变动监控详解 2023-05-15
- C++实战之二进制数据处理与封装 2023-05-29
- C语言 详解字符串基础 2023-03-27
- 带你深度走入C语言取整以及4种函数 2022-09-17
- C语言实现宾馆管理系统课程设计 2023-03-13
- C语言编程C++旋转字符操作串示例详解 2022-11-20
- [C语言]二叉搜索树 2023-09-07
- centos 7 vscode cmake 编译c++工程 2023-09-17
- 全面了解C语言 static 关键字 2023-03-26
- [c语言-函数]不定量参数 2023-09-08
