Sublime Forum

Clang (C/C++/Objective-C/Objective-C++) autocomplete

#25

Well the file is there : c:\MinGW\include

And none of those work:

    "options":
    
        "-Wall",
        "-I/C/MinGW/include",
        "-IC/MinGW/include",
        "-IC:/MinGW/include"
    ]
0 Likes

#26

Actually, looks like you’ve found a bug in Sublime Text.

Please upgrade the plugin to the latest version just submitted that has a fix for this or move the options to your SublimeClang user settings. “-IC:/MinGW/include” should work just fine and is now added to the default include paths. Please let me know if this fixes the issue or if you’re still having problems. Thanks.

0 Likes

#27

BTW, you probably want to edit the SublimeClang user settings anyway as the default settings might be overwritten when the plugin is updated.

0 Likes

#28

It works thanks.

I’ll edit my user settings as you suggested.

0 Likes

#29

This is awesome. Love this. I’ve gotten a fairly complex C++ project, and most things are now working for me.

One thing that doesn’t seem to work for me, is the ctrl-d ctrl-i to jump to the definition. It displays “Don’t know where the implementation is!” on the sublime status line. I’ve peeked at the Python code for the error, but not sure where the problem is or how to debug the python.

I’ve tried with a simple test: myutil.h and myutil.c that exist in the same directory. I’ve also made sure that I’ve got a -I to the same directory that holds myutil.h in the SublimeClang.sublime-settings file. I’m on Mac OS X Lion.

.c file is like:
#include <myutil.h>

int myFunc(int a, int b, double c) {
return a + b;
}

and .h file just has:
int myFunc(int a, int b, double c);

Any ideas?

Thanks again for the excellent work!

0 Likes

#30

Try updating the plugin now, it should be fixed in the latest version in git.

Thanks for reporting this and please let me know if it now works or if it’s still broken :smile:

0 Likes

#31

That fixed it, thanks for the fast turn around.

0 Likes

#32

Is there a way to configure this to autocomplete OS X and iOS frameworks and autocomplete Objective-C properly?

Unfortunately I can’t get the frameworks to autocomplete just by adding an include path since Framework’s are structured Name.framework/Headers/.h
But they are included as <Name/file.h>.

0 Likes

#33

Is there a way to get per-project settings for plugins like this?

I ask because I work on a lot of embedded projects, where the system headers are not useful, and what you frequently want is project-relative headers plus headers from . Many (most) RTOS’ have headers whose names collide with the names of system headers, so you can’t just bulk out the include path.

0 Likes

#34

joh, Try adding something like this to your clang options:

        "-isysroot",
        "/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk",
        "-D__IPHONE_OS_VERSION_MIN_REQUIRED=40300",

I don’t code in Objective-C/Objective-C++ myself, so while I believe basic support is there I’m sure it could be improved. Pull requests with more fleshed out support would be more than welcome :smile:

MikeSmith, No idea regarding per-project settings, please do let me know if you figure it out.

0 Likes

#35

Great work, it took me a while to get it up an running since I am parsing Linux system headers on a Windows machine but now it’s good. Only one question though, is there a way to enable auto-completion in the global namespace without using ::? if I start typing something like ‘epoll_’, I want to see all the possible completion options right away. Right now it doesn’t show anything unless I type ‘::epoll_’.

0 Likes

#36

The default key-binding for triggering autocomplete operations in Sublime Text 2 is “ctrl+space”, so typing ‘epoll_’ and then hitting ctrl+space should work. You can also start typing and hit tab to select the highest scoring completion (another built in Sublime Text 2 feature).

If you are using the dev branch of Sublime Text 2 autocomplete will pop up automatically after typing a few characters, but personally I’ve turned that off since the completions in my sources takes too long :wink:

0 Likes

#37

Wow, this is a great little plugin.

On Mac, is there any way to pick which copy of libclang is used? I don’t know how much the ABI changes, but whichever version you are using / picking up is older than the (svn) copy of clang I am using (which has better c++0x support).

Hope that makes sense!

0 Likes

#38

azumanga, while I haven’t tried it myself, I see no reason why this wouldn’t be possible. Try to replace libclang.dylib in ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/SublimeClang/ with the one you’ve compiled. Not sure if libclang is compiled by default as part of compiling clang, so you might need to specifically compile it as a separate step.

0 Likes

#39

What is preventing this plugin from working in the 64 bit version of Sublime Text for Windows? is it just the clang DLL file that needs to be recompiled or are there are things?

0 Likes

#40

In theory only the libclang.dll needs to be compiled in 64 bit mode. However ttvd tried that and still ran into issues. If someone gets it to work I’d be happy to accept a pull request/patch.

0 Likes

#41

Hi !

I can’t get to work sublimClang.
I’ve followed the tuto for the libclang.so and copy it in the root directory of the package, put I get the error message :

[code]"It looks like libclang.so couldn’t be loaded. On Linux you have to compile it yourself, or install it via your package manager. Please note that this plugin uses features from clang 3.0 so make sure that is the version you have installed.

Once installed, you need to copy libclang.so into the root of this plugin. See http://github.com/quarnster/SublimeClang for more details."[/code]

I’m runnig sabayon. I’have clang3.0 installed and I get the .so from “/usr/lib/llvm/libclang.so”

any idée? thanks

0 Likes

#42

Try putting it in /usr/lib/

0 Likes

#43

same problem

0 Likes

#44

What’s printed in the sublime console?

0 Likes