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++ const 成员函数,返回一个 const 指针.但是返回的指针是什么类型的 const? 2022-10-11
- ubuntu下C/C++获取剩余内存 2023-09-18
- C++ 数据结构超详细讲解顺序表 2023-03-25
- C语言详解float类型在内存中的存储方式 2023-03-27
- Easyx实现扫雷游戏 2023-02-06
- C语言qsort()函数的使用方法详解 2023-04-26
- Qt计时器使用方法详解 2023-05-30
- 我应该为我的项目使用相对包含路径,还是将包含目录放在包含路径上? 2022-10-30
- C语言手把手带你掌握带头双向循环链表 2023-04-03
- 详解C语言中sizeof如何在自定义函数中正常工作 2023-04-09