xavierd / clang_complete

Vim plugin that use clang for completing C/C++ code.
http://www.vim.org/scripts/script.php?script_id=3302
1.96k stars 308 forks source link

Is it possible to use clang_complete for ObjC iOS/Mac development? #172

Closed terhechte closed 11 years ago

terhechte commented 12 years ago

I've been struggling with this for some time now. After installing the plugin, I do get autocompletion for c / c++ code just fine within VIM. But when I have ObjC code it doesn't complete method calls or variables. Example: NSString *t = @"test"; [t string... -> Doesn't complete anything. or "[t s.." etc. "[NSString stringW.." doesn't complete anything either.

SublimeClang (https://github.com/quarnster/SublimeClang/), a Clang binding for SublimeText, on the other hand, works just fine when I'm trying the above example. Are there special settings I need to add to the .clang_complete file? Or is the ObjectiveC selector syntax not supported?

Thanks for any help! Benedikt

ethercrow commented 12 years ago

Clang_complete works for me with objc. Have you checked that command-line clang can compile your sources using the flags you have in .clang_complete?

terhechte commented 12 years ago

@ethercrow could you post a working .clang_complete so that I can see what's in there? That would be rad.

ethercrow commented 12 years ago

Something like that:

-isysroot /path/to/sdks/iPhoneSimulator6.0.sdk
-isystem /path/to/llvm/lib/clang/3.1/include
-F /path/to/sdks/iPhoneSimulator6.0.sdk/System/Library/Frameworks
-I /path/to/sdks/iPhoneSimulator6.0.sdk/usr/include
-D __MACH__
-D __APPLE_CC__
-D __IPHONE_OS_VERSION_MIN_REQUIRED=40300
-fblocks
-fobjc-nonfragile-abi
-fno-builtin
-m32
-fobjc-arc
-include MyProject-Prefix.pch
-Wall
-Wextra
-Wno-arc
-I ./Classes
-I ./opt/JSONKit
-I ./opt/SomeOtherLibrary
-I ./src

-I flags are needed for each directory that contains headers because of the (undocumented and just odd) way xcode looks for headers.

terhechte commented 12 years ago

Thanks for the info. I did a complete new installation before trying it out, but now I get the l:res error that is also mentioned in other issue. I'll try again in a couple of days :) Thanks again.

xavierd commented 11 years ago

The initial bug is fixed.