vim-syntastic / syntastic

Syntax checking hacks for vim
Do What The F*ck You Want To Public License
11.3k stars 1.14k forks source link

Getting header error when using c++'s bits/stdc++.h #2368

Closed larrasket closed 3 years ago

larrasket commented 3 years ago

Whenever I include <bits/stdc++.h> even to an empty file, I get these following errors:

  9 /usr/include/c++/11.1.0/cstring|77 col 11 error| ‘memchr’ has not been declared in ‘::’                                                                                                                                                                                       
  8 /usr/include/c++/11.1.0/cstring|78 col 11 error| ‘memcmp’ has not been declared in ‘::’
  7 /usr/include/c++/11.1.0/cstring|79 col 11 error| ‘memcpy’ has not been declared in ‘::’
  6 /usr/include/c++/11.1.0/cstring|80 col 11 error| ‘memmove’ has not been declared in ‘::’
  5 /usr/include/c++/11.1.0/cstring|81 col 11 error| ‘memset’ has not been declared in ‘::’
  4 /usr/include/c++/11.1.0/cstring|82 col 11 error| ‘strcat’ has not been declared in ‘::’
  3 /usr/include/c++/11.1.0/cstring|83 col 11 error| ‘strcmp’ has not been declared in ‘::’
  2 /usr/include/c++/11.1.0/cstring|84 col 11 error| ‘strcoll’ has not been declared in ‘::’
  1 /usr/include/c++/11.1.0/cstring|85 col 11 error| ‘strcpy’ has not been declared in ‘::’
10  /usr/include/c++/11.1.0/cstring|86 col 11 error| ‘strcspn’ has not been declared in ‘::’

However if I ignored it and compiled, it would compile without any warnings. Tried to reinstall gcc-libs and gcc, but didn't fix it

lcd047 commented 3 years ago

Syntastic is a Vim script, it doesn't know (nor cares) about C++ syntax. What syntastic does is it runs third-party linters against your files, and shows you the linters' output in a window. In order for said output to be useful you have to configure both syntastic and the linters to suit your particular project (the process is described in the manual). It won't work by default, syntastic isn't supposed to (and can't) guess what a sensible configuration might be for your particular situation.

On a side note: even if you take your time to configure everything properly, syntastic isn't great for working with C/C++ projects. You should consider using something like YCM instead. Also please note that syntastic is essentially dead, it has been superseded by ALE for Vim 8+.