yvesdm3000 / ClangLib

Code::Blocks plugin integrating various features of LLVM Clang.
5 stars 4 forks source link

string class is not recognized #12

Closed Max-Z80 closed 7 years ago

Max-Z80 commented 7 years ago

hello, under my linux, this plugin does not seem to recognize the #include if i write string a("test"); a. // here not attributes or methods are proposed.

yvesdm3000 commented 7 years ago

Does your code compile ? Did you import the namespace 'std' ? Maybe try #include <string> int main() { std::string a("test"); a. // <-- I get the codecompletion here }

Max-Z80 commented 7 years ago

Hello, Found the pb. It's not a bug from your plugins. When I ran codeblock in the terminal, I found the following lines: /usr/include/wchar.h:51:11: fatal error: 'stdarg.h' file not found /usr/include/wchar.h:51:11: fatal error: 'stddef.h' file not found indeed these files where not in /usr/include. So I moved them in /usr/include and now the completion for string works like a charm. I guess this is a temporay solution. Is there a better way to proceed ?

Max-Z80 commented 7 years ago

actually, I am wondering somethiing. the stdarg.h is present in my system in the following folders: find / -name stdarg.h -print /usr/lib/gcc/i686-pc-linux-gnu/4.9.3/include/g++-v4/tr1/stdarg.h /usr/lib/gcc/i686-pc-linux-gnu/4.9.3/include/stdarg.h /usr/lib/clang/3.7.1/include/stdarg.h /usr/include/stdarg.h // added by me = the workaround

and for the other header: find / -name stddef.h -print /usr/lib/gcc/i686-pc-linux-gnu/4.9.3/include/stddef.h /usr/lib/clang/3.7.1/include/stddef.h /usr/src/linux-4.4.6-gentoo/include/uapi/linux/stddef.h /usr/src/linux-4.4.6-gentoo/include/linux/stddef.h /usr/include/stddef.h //added by me = the workaround /usr/include/linux/stddef.h

It's maybe normal that these 2 headers were not in the /usr/include by default as it seems they are compiler specific. In that case, then the plugin should be able to take that into account, no?

yvesdm3000 commented 7 years ago

The plugin will try to find the include paths from the configured compiler so you must make sure codeblocks can compile the file... Also in the project options you can add search paths for include files, that is also passed to libclang.

Max-Z80 commented 7 years ago

pb solved. It's all good.