Visual studio C++ Both build and intellisense suddenly show thousands of errors in external libraries

alpha02 0 Reputation points

Using C++ 20 in visual studio 2022, windows 10. Libraries: libtorch (gpu), CUDA toolkit, Eigen.

I was tweaking things in my code when suddenly intellisense started showing errors where there were none. Those kept popping up until intellisense stopped completely.

"C++ There are too many errors for the IntelliSense engine to function properly, some of which may not be visible in the editor."

When I try to build there also are thousands of errors. Odd thing is, none of them are in my code. They all come from the standard lib, or CUDA, or libtorch. I assume I accidently flipped a switch somewhere that broke everything, any idea of where it could have come from ? Or how I could diagnose it ?

Update 1 :

I managed to track down the issue to "#include <torch/torch.h>" by watching which header cause intellisense's color coding to vanish. If this include is commented, everything is displayed as it normally should be (except of course everything including libtorch, but at least the errors shown in intellisense and while building are correct).

I have not changed anything regarding libtorch, (nor anything with my installs at all) and it used to work perfectly fine. Also, the only file in which intellisense works when <torch/torch.h> is included is the first (and only) header that includes it directly. And given that the erroneous build errors also appear in the CUDA toolkit and std lib, libtorch is likely fine.

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,600 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. alpha02 0 Reputation points

    I found the problem: two macros had the same name ("CUDA"). The behaviour of MSVC and intellisense made it really hard to track, something maybe could be done at this level.

    0 comments No comments