Intellisense ignoring content of file when using "unity build" file structure
Hi there. I have been using the "unity build" file structure outlined in this video: https://youtu.be/PJmpOhk9GXw?t=660 (relevant content at about 11:00).
This has been working fine for a year or two now, but this week it has suddenly started causing issues, I started experiencing this problem after updating visual studio 2022 to the most recent version.
The program still compiles and runs as expected, but intellisense is throwing up errors any time I reference something declared in a separate file.
Additionally, this problem is present on another machine I tested the small example on, and someone else has recently commented on the video about experiencing seemingly the same issue, so I'm fairly confident it's a wider problem than just my machine.
I've created a small example that demonstrates the problem I'm facing.
Main file:
#include <iostream>
int a = 15;
#include "file1.cpp"
int main()
{
std::cout << b;
}
file1.cpp:
int b = a;
The file structure: (file1.cpp is excluded from the build so that it does not get compiled individually)
The error from intellisense:
Again this file structure was working perfectly until recently, and I've been banging my head trying to solve what the problem is.
The program still compiles and runs correctly, I've tried all the standard solutions to a broken intellisense (e.g. deleting the .suo files) but it seems to be a deeper issue than that.
I use this file structure in several projects so I'd appreciate help in solving it, refactoring everything to a more standard build model isn't something I want to do.
Thanks in advance.