使用clang_complete与OS X框架 [英] Using clang_complete with OS X frameworks

查看:316
本文介绍了使用clang_complete与OS X框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我将以下内容保存到/tmp/test.cpp:

If I save the following to /tmp/test.cpp:

#include <CoreServices/CoreServices.h>
#include <iostream>

int main() {
  CFStringRef my_string = CFSTR("hello, world!");
  std::cout << CFStringGetLength(my_string) << '\n';
}

我可以使用!clang ++ -framework CoreServices%,但是clang_complete无法从CoreServices完成任何操作。

I can compile this correctly with !clang++ -framework CoreServices %, however clang_complete can't complete anything from CoreServices.

文档说我应该在.clang_complete文件中放置编译器选项(在这种情况下,我使用/tmp/.clang_complete),但是我尝试过的所有far结果在 test.cpp ||未知的参数:'-framework'出现在快速修复窗口中。

The docs say I should place compiler options in a .clang_complete file (in this case I'm using /tmp/.clang_complete), however everything I've tried so far results in test.cpp|| unknown argument: '-framework' appearing in the quick fix window.

获取clang_complete正确处理框架的正确方法是什么? / p>

What's the correct way of getting clang_complete to deal with frameworks correctly?

推荐答案

请参阅 clang_complete:iOS的Vim自动完成一个有用的答案。显然 clang_complete 使用 -cc1 选项,不支持 -framework 参数。

See clang_complete: Vim autocompletion for iOS for a helpful answer. Apparently clang_complete uses the -cc1 option which doesn't support the -framework argument.

我能够使用 -triple -target -arch 参数替换选项作为替代 args可以替换 -framework

I was able to use -triple and -target options as replacements for the -arch argument I needed, maybe one of the -cc1 args can replace -framework?

要重现您的错误,您可以执行

To reproduce your error, you can do

:! clang -cc1 % -framework CoreServices

所以我认为现在的问题变成了 clang -cc1 ?。

So I think the question now becomes "How can I pass frameworks to clang -cc1?".

编辑:运行

clang++ -v -framework CoreServices ./test.cpp 

您可以获取 clang -cc1

的输出

-triple x86_64-apple-macosx10.6.7 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name test.cpp -pic -level 1 -mdisable-fp-elim -relaxed-aliasing -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 123.2 -v -resource-dir /Developer/Platforms/iPhoneOS.platform/Developer/ usr / bin /../ lib / clang / 2.1 -fdeprecated-macro -ferror-limit 19 -fmessage-length 179 -stack-protector 1 -fblocks -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics - o /var/folders/w2/w26NavGvGauuJwhTtEeQ9++++TI/-Tmp-/cc-GbJXd6.o -x c ++ ./test.cpp

我删除了-o参数和输入文件,从结尾添加到 .vimrc 中的用户选项,但代码完成仍然不工作正确.. Hmm

I removed the -o argument, and the input file, from the end and added it to the user options in .vimrc but code completion still doesn't work correctly.. Hmm

这篇关于使用clang_complete与OS X框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆