0

I have been using neovim as my main IDE for competitive programming with YouCompleteMe in WSL. But I recently decided to switch from WSL to Windows since WSL was causing an absurd amount of lag while opening initially.

When I was using bits/stdc++.h as my header file in WSL everything worked fine but on windows YouCompleteMe is showing "Too many fatal errors". However MinGW is able to compile it without any problem.

Is there any way I could add support for bits/stdc++.h in YCM?

PS. Error is caused by YCM and not by the compiler.

shivanshu
  • 654
  • 5
  • 5
  • 8
    [Why should I not #include ?](https://stackoverflow.com/questions/31816095/why-should-i-not-include-bits-stdc-h) – Yksisarvinen Mar 31 '21 at 14:09
  • 1
    For competitive programming bits/stdc++.h is fine, you're writing programs that you won't need to work on or maintain in the future, and you get to write less boilerplate code – Dario Petrillo Mar 31 '21 at 14:13
  • 2
    Step one: Figure out what the actual standard library headers you're using are. There probably aren't that many if you've just been doing smallish competitive programming exercises. ``, ``, ``, `` are some of the likeliest ones but you can look up others by checking what names you use from the `std::` namespace and checking a source like [cppreference](https://en.cppreference.com/w/) to find out where they're actually from. Step two: Actually use those instead of ``. – Nathan Pierson Mar 31 '21 at 14:14
  • 2
    @DarioPetrillo It obviously isn't fine for this specific asker or this question wouldn't have come up. – Nathan Pierson Mar 31 '21 at 14:15
  • @Yksisarvinen https://medium.com/dsc-dypcoe/must-know-c-tips-and-tricks-for-competitive-programming-part-1-d8a4d38243f5#:~:text=the%20header%20file.-,%3Cbits%2Fstdc%2B%2B.,in%20%3Cbits%2Fstdc%2B%2B. – shivanshu Mar 31 '21 at 14:33
  • 1
    @NathanPierson In competitive programming contest there isn't enough time to see which header file your program requires. bits/stdc++.h includes all the necessary header file that the program requires. – shivanshu Mar 31 '21 at 14:36
  • @shivanshu "*It is not the standard header file of the GNU C++ library, hence compilers other then GCC might not able to compile it.*" Even this article provides an answer to your question. It's not going to work with Microsoft compilers. – Yksisarvinen Mar 31 '21 at 14:38
  • @shivanshu -- I think most of the responders here understand that `bits/stdc++.h` is a compiler-specific header that happens to do what some folks want. As the question clearly indicates, it's not portable. The comments here go to that non-portability. – Pete Becker Mar 31 '21 at 14:39
  • 2
    "Before C++ 11, data types were mandatory to be defined during compile-time, but later on, the auto keyword was introduced which gave us the freedom to declare a variable at runtime." This is not what the `auto` keyword does. Be careful taking advice from sources that don't _really_ know what they're talking about. – Nathan Pierson Mar 31 '21 at 14:40
  • @Yksisarvinen I know that it is not a standard header file and is only gcc/g++ specific, but MinGW is gcc based and compiler is not even causing any problem (mentioned in the description). YCM is showing "Too many fatal errors" – shivanshu Mar 31 '21 at 14:46
  • @NathanPierson This question isn't asking for your suggestion on which header files to use in competitive programming. If you don't know bits/stdc++.h is used for almost every question (except questions involving time complexity) in competitive programming. Also I am asking for is how to prevent YCM from showing error in neovim since MinGW compiles the program just fine. – shivanshu Apr 04 '21 at 10:54

0 Answers0