-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using default .ycm_extra_conf.py, the standard c++11 headers are not found. #303
Comments
This didn't work for me. Also, I get the same thing as #192. |
I've gone through this too and assumed that the current behavior won't try check clang default include directories from compiler flags as |
I found out that YCM keeps adding This works fine:
This fails:
I stripped |
I found this: https://gist.github.com/locojay/4950253 And it works wonders. Basically, the only include flag you really need is This should also fix #305. |
The YCM adds the path to |
@Valloric Does that answer whether it's assumed as issue or not for YCM not to be able to automatically include default included header files (which for flags Just passing the same flags you're passing to gcc/clang when you compile your source files won't lead to working completion, one must know which headers the compiler include by default for a given set of flags, and include those by hand (IIRC, I had to list even simple |
@oblitum Yes, that is troubling... I still can't understand why freaking libclang won't use its default header search paths for code completion like it would for normal compilation. I guess we need a way to pull out the default search paths and append them. Any ideas? We can't call the clang binary because it may not exist on the system. The solution would have to be based on pure libclang. I know some Clang developers; I'll ask what they think about this. |
@Valloric Sadly, from libclang solely, I've no idea... But, should this issue just be kept closed? At last, this seems a good place for solutions to be brought and, this is indeed a thing newcomers may stumble upon recurrently. |
If not reopened, I think it's a good item for FAQ (I've not checked whether there's one such item already). |
Reopening until we figure this out fully. |
Could we include a few example |
I just have the similar problems and now I have solved them. If standard headers are not found, the good tool to debug is to use :YcmDiages in vim to see the bug information. You will see what errors are there, such as in xxx.h, yyy.h cannot find. Then you will find yyy.h and add the correct include path to the .ycm_extra_conf.py. Another thing is sometimes the auto-completion cannot find members of a class I defined. The problem is there are errors in :YcmDiages. It seems sometimes if there are errors, ycm stop auto-competion for you... |
On OS X 10.9 with Xcode 5.0.1 you can add
to your compile flags to get completion for the STL until there is a proper fix for this issue. The STL include path can be obtained with (as suggested by @oblitum): |
I've mentioned this issue in the FAQ along with a workaround. I'm looking into a more long-term fix as well, sit tight. |
I'm writing this just in case someone else runs into the same problem I hit:
It's in the cstdint header, apparently clang cannot find the proper stdint.h header, even if I add |
I'm having the same issues on my linux machine, too. Unfortunately, the suggested workarounds don't work for me. It's not only the std headers that are not found but also other stuff like eigen3. But for some reasons boost headers are found by default without specifying any additional include directories. |
Comment out '-Wc++98-compat' from your |
I have fixed my standard header version incompatibility problems by turning off clang's default standard header paths and adding correct ones.
|
Thanks! |
For me the only way to get and std::cout / std::endl working was to add
and the Using Ubuntu MATE 16.04, g++ 5.3.1 (Ubuntu 5.3.1-14ubuntu2) 20160413 Hope this helps |
IMHO there might be a potential problem using -I flag instead of -isystem |
@Valloric Can you confirm that this is still the case with libclang 3.8? I've noticed the problem showing up recently in Debian testing, and after investigating a little, it seems to coincide with an upgraded version of Debian's ycmd, which started being built against clang 3.8 around the middle of April—and, IIRC, that's around the time standard headers stopped being included properly. I installed Ubuntu 16.04 (which also has ycmd built against clang 3.8) into a virtual machine to test it--same issue: standard headers are not found by default. I can apply the workaround to get it to work, but that's a nuisance, particularly since the workaround needs to be updated in every project every time stdlibc++ gets a major version upgrade, which is going to be happening more frequently with GCC's new versioning scheme.
The current situation on Debian/Ubuntu seems to be failing this goal: even a simple C++ hello world doesn't work properly. If this is something Debian and Ubuntu have screwed up in libclang-3.8, responsibility for fixing it obviously goes there, but if this is an upstream llvm change, this really needs a fix either in ycm or upstream llvm. |
[READY] Fix RestartServer command in Python completer `RestartServer` subcommand is not working because the `request_data` parameter is not given to the `RestartServer` method. Since this parameter is not used, remove it. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/303) <!-- Reviewable:end -->
Not working anymore with libclang 3.8. I've tried various conf, |
If you have a new problem, please raise a new issue, following the instructions in CONTRIBUTING.md |
Hi @puremourning , I filed #2330 for the new problem (the root problem is still exactly the same though) as reported by @jagerman (and I can also confirm it), in particular discussing the need for Linux workaround similar to the macOS one. Cheers. |
- NERDtree * Use F5 to toggle NERDtree - NERDcommenter * ,ca to switch between // and /**/ * ,cl to use aligned comments * ,cA to add comment at the end of line - vim-indent-guides * ,ig to enable the feature - YouCompleteMe * Tried but not yet installed * Because the std library cannot autocomplete * ycm-core/YouCompleteMe#303 - syntastic * Disable the plugin because it only compiles one file - vim-airline - vim-repeat - vim-surround * ys to add surround environemnt * cs to change surround environment - tagbar * Use F7 to open tagbar - taglist * depends on ctags * Use F11 to open taglist - Setup the ruler of git commit message - Liu - vim-color * for solarized theme * also made modifications about the term setting for the theme * .dircolors is added for directory theme for solarized
In the FAQ of Valloric/YouCompleteMe, there was an issue of C++ standard library headers not found (ycm-core/YouCompleteMe#303) that has been resolved with a workaround, and @cpradog has kindly implemented it. However, this workaround has not yet been incorporated into template.py in rdnetto/YCM-Generator, so adding this becomes the main purpose of this fork.
…83ecfc6 In the FAQ of [Valloric/YouCompleteMe](https://github.com/Valloric/YouCompleteMe), there was an issue of C++ standard library headers not found (ycm-core/YouCompleteMe#303) that has been resolved with a workaround, and @cpradog has kindly implemented it. However, this workaround has not yet been incorporated into template.py in [rdnetto/YCM-Generator](https://github.com/rdnetto/YCM-Generator), so adding this becomes the main purpose of this fork.
…83ecfc6 In the FAQ of https://github.com/Valloric/YouCompleteMe, there was an issue of C++ standard library headers not found (ycm-core/YouCompleteMe#303) that has been resolved with a workaround, and @cpradog has kindly implemented it. However, this workaround has not yet been incorporated into template.py in https://github.com/rdnetto/YCM-Generator, so adding this becomes the main purpose of this fork.
To anyone who came here searching for answers to how to include eigen (there was this post by @bfrg from 2013), the correct addition to the ycm_extra_conf.py file is: '-isystem', '/usr/include/eigen3', as of today (early 2017). |
With I still cannot let ycm to find c++ STL names, though all the C++ STL files are in the above directory. Don't know why. I am using MAC running osx 11. |
This is the result after I run #include "..." search starts here: #include <...> search starts here: |
@riveridea you should try to add
so all except the one with |
@vheon It still does not work after I add all the possible paths as you suggested. |
I fix this problem by adding the following lines Running :YcmDiags and you will know what's going wrong |
@macskay hello,where did i to use "'-I', '/usr/include/c++/5/'"? i meet the same problam . |
@macskay hi,i got it .in the ycm_extra_conf.py |
… r=micbou Fix system header search paths on macOS for Objective-C++, too. I've been running into ycm-core/YouCompleteMe#303, even though ycmd has a workaround for it. It looks like the issue is just that I'm writing ObjC++ and that change only affects C++. So, this change makes `-x objective-c++` eligible, too. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/1193) <!-- Reviewable:end -->
I set
g:ycm_global_ycm_extra_conf
in my vimrc.After including a c++11 header
unordered_map
, I got'unordered_map' file not found
reported by Syntastic plugin.After adding
in
flags
in.ycm_extra_conf
, now my problem is solved.In default
.ycm_extra_conf
, the environment didn't include any c++11 headers, but the argument-std=c++11
still inflags
?I think it's strange. Something should be wrong.
I use the mac os 10.7.5 (Lion) and the following is report by
:YcmDebugInfo
command, hope it helps.The text was updated successfully, but these errors were encountered: