Why does my Visual Studio project constantly say it can't find stdint.h but it builds fine?

Everywhere I try to include stdint.h and use it’s associated types like int32_t or uint8_t, Visual Studio reports "Error: Cannot open source file “stdint.h” ".

When I specify these types as “std::int32_t” the usages are underlined as errors, but I can use VS’s “peek definition” feature to see the file where they are defined.

As long as I only build, and don’t rebuild, everything appears to build fine. Why is Visual Studio so confused here? Here’s a screenshot of what I’m seeing, with the usage underlined, but “peek definition” still working:

Hey janimatriond-

I was able to add an include for stdint.h as well as declare an int32_t, both of which compiled without issue. Can you post the full compile error that you receive? Looking at the screenshot I can’t tell if what is highlighted is intellisense giving a false positive or if it is an actual error. Also, can you try adding the stdint.h include in a new project with no additional content and see if you have the same compile errors.

Cheers

Could be an intellisense error… Maybe?

Edit: What I mean by that is intellisense kinda sucks for UE4/C++ in my experience so I just turn it off but I see a lot of weird stuff like that. I normally just use Resharper carefully configured.

They are build errors, not intellisense errors. Intellisense can actually find the header file, which is why it can Peek Definition. I created a new project and I don’t have the same issue. These errors only pop up occasionally and can often be fixed by rebuilding rather than building, or vice versa. The errors are pretty non-deterministic.