Home Download Buy Blog Forum Support

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

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby quarnster on Tue Dec 06, 2011 10:42 pm

Compiling libclang using Visual C++ was trivial so with the latest version in git getting the location of errors and warnings should be fine on Windows.

As for it not picking up your include paths, try modifying the user settings rather than the default settings. You can access those by ctrl+shift+P and typing "SublimeClang".
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby mnus on Tue Dec 13, 2011 6:23 pm

Regarding Linux errors

I'm running Ubuntu 11.10 64bit. I was able to get this plugin working by symlinking /usr/lib/python2.6/ to sublime2's lib directory, and recompiling libclang.so to target a 64bit architecture.

1.) Install python2.6 via apt-get or synpactic.
2.) Backup python26.zip in sublime2's lib directory (just for safe measure). I did mv "python26.zip backup.python26.zip"
3.) Symlink /usr/lib/python2.6/ to sublime2's lib directory.
4.) Download and compile clang. (You can probably get away with installing clang from the ubuntu repos)
5.) Copy libclang.so from the installed location into /.config/sublime-text-2/Packages/SublimeClang/

I'm still left with the issue of Clang not being able to find "stdarg.h", but I believe that's a clang bug and has nothing to do with this plugin.

Note to the the author of this plugin: It's probably best not to include the compiled library for linux in your repository, given that each architecture requires its own build. It may be a better idea just to have a text file instructing linux users to build and copy libclang themselves. Thanks for this awesome plugin!
mnus
 
Posts: 1
Joined: Tue Dec 13, 2011 6:10 pm

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby quarnster on Tue Dec 13, 2011 7:21 pm

Thanks for the tip, I've deleted the default libclang.so and added your work around to the readme at https://github.com/quarnster/SublimeClang/.
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby ttvd on Thu Dec 15, 2011 9:02 am

Hi, I tried installing SublimeClang on Windows 7 x64 (x64 sublime 2), however it did not work. During install through Package manager I get:

Code: Select all
Reloading plugin C:\Users\radix\AppData\Roaming\Sublime Text 2\Packages\SublimeClang\sublimeclang.py
Traceback (most recent call last):
  File ".\sublime_plugin.py", line 57, in reload_plugin
  File ".\sublimeclang.py", line 31, in <module>
    from clang import cindex
  File ".\clang\cindex.py", line 86, in <module>
    lib = get_cindex_library()
  File ".\clang\cindex.py", line 76, in get_cindex_library
    return cdll.LoadLibrary('libclang.dll')
  File ".\ctypes\__init__.py", line 431, in LoadLibrary
  File ".\ctypes\__init__.py", line 353, in __init__
WindowsError: [Error 193] %1 is not a valid Win32 application


Thanks.
ttvd
 
Posts: 8
Joined: Sun Apr 17, 2011 12:57 am

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby quarnster on Thu Dec 15, 2011 11:43 am

Until someone contributes a 64-bit libclang.dll, you'll have to make do with using the 32 bit Sublime Text 2 if you want to use this plugin.
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby ttvd on Thu Dec 15, 2011 10:55 pm

quarnster wrote:Until someone contributes a 64-bit libclang.dll, you'll have to make do with using the 32 bit Sublime Text 2 if you want to use this plugin.


Yeah I thought this was the case. I did manage to build libclang in 64 mode for windows. However, now I get these when it's trying to autocomplete on -> or ::

Perhaps there's an issue with how I built it..

Code: Select all
Traceback (most recent call last):
  File ".\sublime_plugin.py", line 175, in on_query_completions
  File ".\sublimeclang.py", line 596, in on_query_completions
  File ".\clang\cindex.py", line 1568, in codeComplete
WindowsError: exception: access violation writing 0x00000000000C0000
Traceback (most recent call last):
  File ".\sublimeclang.py", line 175, in worker
  File ".\clang\cindex.py", line 1546, in reparse
WindowsError: exception: access violation writing 0x0000000004EC0000


Here's my libclang (x64, compiled using vc2010).
http://ttvd.org/temp/libclang_x64_vc2010.rar

Thanks!
ttvd
 
Posts: 8
Joined: Sun Apr 17, 2011 12:57 am

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby quarnster on Fri Dec 16, 2011 9:30 am

Are you working with huge files or is there any other reason you must use the 64-bit executable of Sublime Text 2?
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby captainhorst on Sat Dec 17, 2011 1:14 am

mnus wrote:I'm still left with the issue of Clang not being able to find "stdarg.h", but I believe that's a clang bug and has nothing to do with this plugin.

Hi,
I got it working on Arch Linux.
You have to add the header search path /usr/lib/clang/3.0/include to SublimeClang's config. If your distribution doesn't have clang 3.0 yet, you can find those headers in clang-3.0.src/lib/Headers of http://llvm.org/releases/3.0/clang-3.0.tar.gz

Thanks for your work, quarnster!
captainhorst
 
Posts: 1
Joined: Sat Dec 17, 2011 12:55 am

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby alanandersen1 on Sun Dec 18, 2011 3:38 am

Wow... this is utterly mind blowing even in its early state. My vote for best plugin...ever?

I would have killed for the equivalent of visual studio's f12, and now i have it, plus really good code completion that just works (still a bit rough, but its great still)... props to you quarnster.

Edit: To help other newbies, to get the most out of it I had to change my options and add them to the User version of SublimeClang.sublime-settings like so: (on mac os lion, will try win 7 64 bit eventually)

Code: Select all
   
"options":
       [
           "-Wall",
           "-std=c++11",
           "-I/usr/lib/clang/3.0/include/",
           "-I/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1",
           "-I/Users/alanandersen/dev"
       ]


Also, it seems once you install Xcode 4.2, all the gcc stuff is moved from /usr/ into /Developer, took a bit to figure that out...
Last edited by alanandersen1 on Mon Dec 19, 2011 12:02 am, edited 1 time in total.
alanandersen1
 
Posts: 10
Joined: Mon Jul 25, 2011 4:45 pm

Re: clang (C/C++/Objective-C/Objective-C++) autocomplete

Postby quarnster on Sun Dec 18, 2011 9:40 am

Cheers for the props guys :)

Please let me know if you have any specific requests or suggestions for making it better. Pull requests with new features are welcome.
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

PreviousNext

Return to Plugin Announcements

Who is online

Users browsing this forum: Exabot [Bot], Yahoo [Bot] and 18 guests