Closed qige96 closed 5 years ago
This plugin also needs g:ncm2#gcc_path
to auto detect the system header directories.
libclang
does not detect system header directories. If gcc
is not possible on your system, we need a fallback approach for detecting system header directories.
However, after I switch the github repo to an earlier branch feature-fixits, the problem is solved. Thus, I think this should be a bug.
It's actually a recent change of behavior. What is the location of your c/c++ system headers? We need a reliable way to detect the system header directories.
I have gcc on my system (cygwin64), but I didn't add it to my environment variables. Just now I add it, and the problem solved! Yet it still cannot find header files. Below ar locations of my headers files
gcc.exe
is in D:\cygwin64\bin
,clang.exe
is in D:\Program Files\LLVM\bin
D:\cygwin64\usr\include
or D:\cygwin64\lib\gcc\x86_64-pc-cygwin\7.4.0\include
D:\cygwin64\lib\gcc\x86_64-pc-cygwin\7.4.0\include\c++
So what should I put in g:ncm2#gcc_path
?
You can open a C/C++ file, then execute :echo ncm2_pyclang#get_args_dir()
to
print the compiler arguments picked and passed to libclang.
I also need the result of gcc -xc++ -E -Wp,-v -
on your cmd.exe
. I guess it's using /usr/include
style path instead of D:\cygwin\...
Er......I open a C file, then execute :echo ncm2_pyclang#get_args_dir(), here is the print-out
[['-include', '../config.h', '-I../common', '-I/usr/include/c++/4.5.3/', '-I/usr/include/c++/4.5.3/x86_64-slackware-linux/', '-ferror-limit=99999999', '-xc', '-isystem', '/usr/lib/gcc/x86_64-pc-cy
gwin/7.4.0/include', '-isystem', '/usr/include', '-isystem', '/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/../../../../lib/../include/w32api'], 'C:\Users\v_rickyzhu\AppData\Local\nvim']
The result of gcc -xc++ -E -Wp,-v -
is like this:
C:\>gcc -xc++ -E -Wp,-v -
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/../../../../x86_64-pc-cygwin/include"
ignoring duplicate directory "/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/../../../../x86_64-pc-cygwin/lib/../lib/../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/x86_64-pc-cygwin
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include/c++/backward
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/include
/usr/include
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/../../../../lib/../include/w32api
End of search list.
So, do I need to pick one of the path above as my g:ncm2#gcc_path
?
The latest branch find no header files, but the old branch does get some results: the old branch get C headers of Clang and MSVC
also C++ headers of MSVC
Problem is that both of them cannot find C++ headers of Gcc and Clang, and C headers of Gcc. (I didn't set g:ncm2#gcc_path
option )
Is it possible to install gcc on Windows directly instead of on Cygwin? I think it should work in this case.
It seems it is not possible https://gcc.gnu.org/install/binaries.html
OK. I've got two possible solution. Wait for my PR.
So currently we have a just-so-so solution: use the old branch and install Clang and MSVC. Actually it is not so cool because MSVC is somewhat annoying, and both of their lib have no stdio.h
and stdlib.h
, etc.
Dinner on around 18:00. Sorry if I didn't reply to you on time.
@qige96 Please test #27
I don't have windows vim environment setup on my PC. Not sure that branch gonna work without further debugging...
Congratulations, seems you are successful in finding C headers, but still C++ headers not found.
The new program can locate headers under D:\cygwin64\usr\include
, where most C headers stay, but C++ headers are inside D:\cygwin64\lib\gcc\x86_64-pc-cygwin\7.4.0\include
Test https://github.com/ncm2/ncm2-pyclang/commit/9a45aeefb754b36a0fa3b960cca1b19f4ecf5a7c
By the way, since you already have cygwin, why not use the neovim inside cygwin? It's easier to get things working in cygwin.
Still it can find C headers but not C++ headers. Well, not a big problem for me, since I hardly write C++ code. You can close the issue now. By the way, I prefer software built for specific platform, so I seldom use tools in cygwin.
After all, Thanks for your great tools and helpful work!
Hi, I meet ncm2 today and tried it. It was incredibly cool and useful, even on Windows system. Everything went well when I set up my Python and JavaScript support, until I went into ncm2-pyclang. Below is the error message when I run
:message
For more information, I paste my whole
init.vim
file here:I spent hours trying to work around the problem in vain. However, after I switch the github repo to an earlier branch
feature-fixits
, the problem is solved. Thus, I think this should be a bug.