Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>clang_complete</h2> <hr> <p>Thanks for using <strong><a href="https://bitbucket.org/Alexander-Shukaev/vim-for-windows" rel="noreferrer">Vim for Windows</a></strong>, hope you enjoy.</p> <p>To solve your problem you have to utilize <code>.clang_complete</code> file. Read more about it in <code>:h clang_complete</code>. In brief, you can put this file into the root directory of any of your projects (i.e. for each project this file can be different, what perfectly makes sense, since different projects have different toolchain configurations). Here is the sample for MinGW-w64 toolchain:</p> <pre><code>-ID:/Toolchains/x64/MinGW-w64/4.8.1/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++ -ID:/Toolchains/x64/MinGW-w64/4.8.1/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++/x86_64-w64-mingw32 -ID:/Toolchains/x64/MinGW-w64/4.8.1/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++/backward -ID:/Toolchains/x64/MinGW-w64/4.8.1/lib/gcc/x86_64-w64-mingw32/4.8.1/include -ID:/Toolchains/x64/MinGW-w64/4.8.1/lib/gcc/x86_64-w64-mingw32/4.8.1/include-fixed -ID:/Toolchains/x64/MinGW-w64/4.8.1/x86_64-w64-mingw32/include -ID:/Libraries/x64/MinGW-w64/4.8.1/Boost/1.54.0/include -ID:/Libraries/x64/MinGW-w64/4.8.1/Qt/4.8.5/include -ID:/Libraries/x64/MinGW-w64/4.8.1/Eigen/3.1.3/include "-ID:/Libraries/x64/MinGW-w64/4.8.1/Example with Spaces/0.0.1/include" -std=c++11 -DUNICODE </code></pre> <p>When you are editing some file in the project with Vim, <code>clang_complete</code> traverses backward all the parent directories of the edited file until it stumbles across the first <code>.clang_complete</code> file to read. Then it reads all these flags/switches/definitions and uses them during the invocation of <code>libclang</code> for completion.</p> <h2>YouCompleteMe</h2> <hr> <p>These days, I don't use <code>clang_complete</code> anymore. There is more powerful semantic autocompletion plugin for Vim our there. It's <strong><a href="https://github.com/Valloric/YouCompleteMe" rel="noreferrer">YouCompleteMe</a></strong>. I highly recommend you try it out. For semantic completion of C-family languages (C/C++/Objective-C/Objective-C++) it uses <code>libclang</code> as well. It relies on a robust C++ back end, and is therefore incredibly fast. It has great integration with <strong><a href="https://github.com/scrooloose/syntastic" rel="noreferrer">syntastic</a></strong> (another must have plugin for Vim). It has an ability to jump to definitions, and so on.</p> <p>Since it's written in C++ and glued to Vim via Python, you'd have to compile the C++ back end. To ease the pain you can download prebuilt and ready to use YCM plugin from my <strong><a href="https://bitbucket.org/Alexander-Shukaev/vim-youcompleteme-for-windows" rel="noreferrer">Vim YouCompleteMe for Windows</a></strong>. I've built it for both x86 and x64 architectures. The native component is called <code>ycm_core.pyd</code>. As usual the architecture of the Vim build you chose has to match the YCM build (i.e. <code>ycm_core.pyd</code>). YCM can work <strong>ONLY</strong> with Python 2 (not 3), so just make sure that you have Python 2 DLL (e.g. <code>python27.dll</code>) and Python 2 Interpreter (<code>python.exe</code>) in the <code>PATH</code> environment variable.</p> <p>If you need LLVM/Clang, you can download it from me as well: <strong><a href="https://bitbucket.org/Alexander-Shukaev/llvm-for-windows" rel="noreferrer">LLVM for Windows</a></strong>. Again, just make sure that you have <code>libclang.dll</code> in the <code>PATH</code> environment variable (recommended) <strong>OR</strong> right next to <code>ycm_core.pyd</code>. Once again both x86 and x64 architectures are supported, and once again the architecture should match both Vim's and YCM's ones.</p> <p>Concerning completion:</p> <blockquote> <p>Should he magically find where is the STL?</p> </blockquote> <p>Of course not! This is just an autocompletion system based on Clang front end. How is it supposed to know which toolchain you're currently using to compile your code? You could use anything: Visual C++, Borland C++, GCC, MinGW, MinGW-w64, LLVM/Clang, etc. Each of them has their own standard library and runtime supplied. Thus, in each case you'd have to specify all the paths which your current toolchain uses to find standard includes.</p> <p>For example, in case of GCC, MinGW, MinGW-w64, you can run the following in POSIX shell:</p> <pre><code>g++ -E -x c++ - -v &lt; /dev/null </code></pre> <p>Or in Windows Command Prompt:</p> <pre><code>g++ -E -x c++ - -v &lt; nul </code></pre> <p>And look for the following excerpt:</p> <pre><code>#include &lt;...&gt; search starts here: d:\toolchains\x64\mingw-w64\4.8.1\posix\seh\bin\../lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++ d:\toolchains\x64\mingw-w64\4.8.1\posix\seh\bin\../lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++/x86_64-w64-mingw32 d:\toolchains\x64\mingw-w64\4.8.1\posix\seh\bin\../lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++/backward d:\toolchains\x64\mingw-w64\4.8.1\posix\seh\bin\../lib/gcc/x86_64-w64-mingw32/4.8.1/include d:\toolchains\x64\mingw-w64\4.8.1\posix\seh\bin\../lib/gcc/x86_64-w64-mingw32/4.8.1/include-fixed d:\toolchains\x64\mingw-w64\4.8.1\posix\seh\bin\../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/include End of search list. </code></pre> <p>This tells you all the paths to standard includes which GCC, MinGW, MinGW-w64 use <strong>implicitly</strong> during compilation of your code.</p> <p>For LLVM/Clang, you can do the same:</p> <pre><code>clang++ -E -x c++ - -v &lt; /dev/null </code></pre> <p>Or:</p> <pre><code>clang++ -E -x c++ - -v &lt; nul </code></pre> <p>When you know the paths, you can happily add them into <code>.ycm_extra_conf.py</code>. For instance, in my case:</p> <pre><code>'-I', 'D:/Toolchains/x64/MinGW-w64/4.8.1/POSIX/SEH/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++', '-I', 'D:/Toolchains/x64/MinGW-w64/4.8.1/POSIX/SEH/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++/x86_64-w64-mingw32', '-I', 'D:/Toolchains/x64/MinGW-w64/4.8.1/POSIX/SEH/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++/backward', '-I', 'D:/Toolchains/x64/MinGW-w64/4.8.1/POSIX/SEH/lib/gcc/x86_64-w64-mingw32/4.8.1/include', '-I', 'D:/Toolchains/x64/MinGW-w64/4.8.1/POSIX/SEH/lib/gcc/x86_64-w64-mingw32/4.8.1/include-fixed', '-I', 'D:/Toolchains/x64/MinGW-w64/4.8.1/POSIX/SEH/x86_64-w64-mingw32/include', </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload