Skip to content

Instantly share code, notes, and snippets.

@yanghu
Last active July 10, 2018 11:30
Show Gist options
  • Save yanghu/031d5fb45deacbd9b5af to your computer and use it in GitHub Desktop.
Save yanghu/031d5fb45deacbd9b5af to your computer and use it in GitHub Desktop.
How to build YCM on windows.

Instructions for compiling YCM with Clang support

Now prebuilt Clang snapshots are available on the LLVM snapshot builds site. you don't need to compile it yourself, get latest Windows snapshot build from that page.

  1. Install all requirements from the instructions above. Dont compile anything yet. (visual studio 2012 sdk, cmake)
  2. Create a build directory and cd into it. (using MS Visual studio developer command prompt)
  3. Suppose you are've successfully installed Clang from installer in a C:\LLVM dir. Now, run cmake -G "Visual Studio 11" -DPATH_TO_LLVM_ROOT=C:\LLVM . <USERFOLDER>\vimfiles\bundle\YouCompleteMe\third_party\ycmd\cpp. Dont forget to change a VS version and a path to Clang build dir if you are using different VS version or build path.
  4. Open the solution in visual studio and build the whold solution. If you are getting errors like:
    • 'boost::bind' : ambiguous call to overloaded function. This issue was fixed, try updating to the latest version of YCM.
    • unresolved external symbol __imp__clang_createIndex - that means that linker cant find Clang libraries. Check your path specified in Configuration Properties -> Linker -> Input -> Additional Dependencies field.
  5. files should already be in the correct place. if not, do this: copy ycm_core.pyd from ycm\Release and libclang.dll from C:\build\bin\Release to <USERFOLDER>\vimfiles\bundle\YouCompleteme\python.

If encounter error about C runtime when running VIM, remove cmake path from system PATH. (because there are multiple msvcr90.dll, one is from cmake path, the other is winsxs, which is the one should be used.

On how to figure our run time error: http://stackoverflow.com/questions/14552348/runtime-error-r6034-in-embedded-python-application

build instruciton page: https://github.com/Valloric/YouCompleteMe/wiki/Windows-Installation-Guide

After everything finished. add following to vimrc so it won't complain about extra conf file, and also works nice with UltiSnips:

let g:ycm_global_ycm_extra_conf = '[userdir]/vimfiles/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
let g:ycm_confirm_extra_conf = 0

" make YCM compatible with UltiSnips (using supertab)
let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment