Closed naive231 closed 12 years ago
probably that src01.h contains invalid code that prevents clang from working.
No! It isn't correct !
I build .clang_complete
and it contains all information of completion of my symbol, it should find correct information despite I include any other nonsense headers. I am not compile any program, none any checking "error" should affect the search result. If symbol is in .clang_complete
, it should be found after I use this plugin to find it.
No, your source is required to be compilable. If you include a header that doesn't compile, clang will stop there.
See https://github.com/Rip-Rip/clang_complete/blob/master/doc/clang_complete.txt?#L205-207
compilable? You mean I should include all stuff that can pass compilation of my src01.cpp
or src02.cpp
? I remember that I had try it before,it fails,too. But that's ok, I'll write another small project to test your solution. :)
Not really, what I meant is that in order to do completion, clang tries to compile your .cpp file and if it fails to do so then completion will not work.
I upload an image about my files usage and put remarks. https://docs.google.com/open?id=0By2IiDMUu0gCN096TUxjTF9iZ2s
test.cpp at left view has two std::
code, upper can show completion menu,but lower can't.
.clang_complete
in the center of view. I include lots of header. Of course, It contains
Content of .clang_complete
.
Well. test.cpp
don't have any my project files any more, I just include some standard stuff like vector or string. But if I include
I can't tell differences about
The 2nd std::
cannot work because the first one creates a compile error. If you write std::string global_string;
instead of the first one then the second one should work. The first one works because there's no errors before that point.
Anyway intermixing header inclusion with code is generally a bad idea, so avoid it.
Oops,sorry for your misunderstanding. ;)
My explanation about those two std::
are not exist at the same time, I just write them in codes for screen shot.
If I just write the upper one std::
only, it can bring correct complete menu on, lower one std::
can't.
So my question is that why can't I include
I have no clue, except that you intermix code with header inclusion which usually no one does.
@Rip-Rip: any idea?
Does a file with just #include
Other than that, I see that you're using header from gcc 4.5.2, and others from gcc 4.6.2, it shouldn't be a problem, but who knows…
I'm using clang v3.2.
If
If
http://clang.llvm.org/cxx_status.html for clang, http://gcc.gnu.org/projects/cxx0x.html for gcc.
You didn't answer my first question: Does a file with just #include
Yes, my code is just a empty main only, nothing more.
I build a
.clang_complete
in my project dir. My sources are in the same dir :$project_root\ --- src01.cpp --- src02.cpp --- src01.h --- src02.h --- .clang_complete
.clang_complete
has those content:-ID:\work\project\suffering_buster\code\project -ID:\svn\windows\tool\MinGW\include -ID:\svn\windows\tool\MinGW\lib\gcc\mingw32\4.5.2\include -ID:\svn\windows\tool\MinGW\lib\gcc\mingw32\4.5.2\include\c++
Then, given an example code like this:
#include <vector>
std::
<- It can show completion list.#include <src01.h>
std::
<- It can't show completion list.WHY ?