Академический Документы
Профессиональный Документы
Культура Документы
Using the Hello World guide, you’ll start a branch, write comments, and open a pull request.
ycm-core / YouCompleteMe
No one assigned
I set g:ycm_global_ycm_extra_conf in my vimrc.
Labels
let g:ycm_global_ycm_extra_conf =
'~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py' None yet
Projects
After including a c++11 header unordered_map , I got 'unordered_map' file not found reported by
Syntastic plugin. None yet
After adding
Milestone
No milestone
'-I',
'/usr/include/c++/4.2.1/tr1/'
In default .ycm_extra_conf , the environment didn't include any c++11 headers, but the argument -
std=c++11 still in flags ?
I use the mac os 10.7.5 (Lion) and the following is report by :YcmDebugInfo command, hope it helps. and others
I've gone through this too and assumed that the current behavior won't try check clang default include
directories from compiler flags as -std=libc++ and -std=c++11 for example. They can be verified
with echo | clang -std=c++11 -stdlib=libc++ -v -E -x c++ -
This fails:
I stripped .ycm_extra_conf.py bare, but YCM keeps adding this to the flags.
Basically, the only include flag you really need is '-isystem', '/usr/lib/c++/v1', .
1
Valloric commented on May 8, 2013 Member
The .ycm_extra_conf.py file linked to from the README is an example file, it's not supposed to cover
everything for everyone. The flags that are there by default work for YCM; you're supposed to make an
extra conf file yourself that best fits your project (usually by modifying the example file). The easiest way
is often to just take the same flags you're passing to gcc/clang when you compile your source files.
YCM adds the path to clang_includes because without those clang-specific includes, semantic code
completion would be slow. Clang needs to be able to see the files in that folder to operate correctly, no
matter what source code you're compiling.
@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 -std=c++11 and -stdlib=libc++
for example, can be easily verified with echo | clang -std=c++11 -stdlib=libc++ -v -E -x c++
- )?.
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 /usr/local/include ).
@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).
Could we include a few example ycm_extra_conf.py in the README? This sounds like a sensible
solution.
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...
-
isystem/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr
to your compile flags to get completion for the STL until there is a proper fix for this issue.
This works if libClang from the Xcode Command Line Tools, i.e.
/Library/Developer/CommandLineTools/usr/lib/libclang.dylib is used as external libClang ( -
DEXTERNAL_LIBCLANG_PATH ) when building YCM.
The STL include path can be obtained with (as suggested by @oblitum):
echo | clang -std=c++11 -stdlib=libc++ -v -E -x c++ -
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:
I got YCM (partially) working but when I run :YcmDiags , it gave me a list of errors, but syntax and
semantic checking seem partially working
error: no member named int8_t in the global namespace
It's in the cstdint header, apparently clang cannot find the proper stdint.h header, even if I add
'/usr/include' in the search directories. The problem is the order of '-I /usr/include' and '-I
/opt/local/libexec/llvm-3.3/lib/c++/v1' , I simply move the '-I /usr/include' parameter to the
front, then the problem is solved, and YCM is now working like a charm.
When using json db for c++ completion headers do not compile #735 Closed
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.
3.4/lib/clang/3.4/include/module.map #749
YCM doesn't recognize size_t in C++ and marks them as an error. #922 Closed
I have fixed my standard header version incompatibility problems by turning off clang's default standard
header paths and adding correct ones.
Hope this will be helpful.
'-nostdinc++',
'-isystem', '/path_to_gcc/include/c++/4.7.2',
'-isystem', '/path_to_gcc/include/c++/4.7.2/x86_64-redhat-linux',
'-isystem', '/path_to_gcc/include/c++/4.7.2/backward',
2
Valloric referenced this issue on May 8, 2014
50 hidden items
Load more…
I just know you need those flags on RH because I use it every day.
Yes, I have read through (at least I believe) the readme, and the closed thing that i have across
which brought me here is this FAQ. However, since my problem is not only C++ but also C, I just
wanna make sure that the fix still applies to me (by using echo | clang -v -E -x c++ -). I used that
workaround and so far so good...
However, didn't see anything talking about red hat or specifically devtoolset-2. Would appreciate if
you point to me :)
—
You are receiving this because you commented.
Reply to this email directly or view it on GitHub
Thanks!
For me the only way to get and std::cout / std::endl working was to add
'-I', '/usr/include/c++/5/'
or
'-I', '/usr/include/c++/5.3.1/'
On Linux (at least Ubuntu, probably others as well), the libclang from llvm.org is now working fine. It
will find paths to the standard library without issues.
@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.
We want to make the 99% use-case easy and pain-free; sometimes that means that the 1% use-
case is more difficult and it's a price we're willing to pay.
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.
bijancn pushed a commit to bijancn/YouCompleteMe that referenced this issue on Jul 26, 2016
Not working anymore with libclang 3.8. I've tried various conf, '-isystem' as well as '-I' and putting
flags from echo | clang -v -E -x c++ -
If you have a new problem, please raise a new issue, following the instructions in CONTRIBUTING.md
Linux also needs heuristic workaround for libclang default include paths Closed
#2330
8 of 11 tasks complete
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.
acherub pushed a commit to acherub/dotfiles that referenced this issue on Sep 20, 2016
leofang added a commit to leofang/YCM-Generator that referenced this issue on Oct 23, 2016
leofang added a commit to leofang/YCM-Generator that referenced this issue on Oct 23, 2016
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
'-isystem',
'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1'
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.
'-isystem',
'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/.
'-isystem',
'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/.
'-isystem',
'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/inclu
'-isystem',
'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacO
@vheon It still does not work after I add all the possible paths as you suggested.
Libclang does not find its include directory on Linux #52 Open
@macskay hello,where did i to use "'-I', '/usr/include/c++/5/'"? i meet the same problam .
compile_commands.json #3159
8 of 12 tasks complete
Fix system header search paths on macOS for Objective-C++, too. #1193 Merged
zzbot added a commit to ycm-core/ycmd that referenced this issue on Feb 23