Visual Studio Code (especially the C/C++ Extension) does a good job. Sometimes a reference cannot be resolved, in that case a restart or clearing/resetting the intellisense cache helps. But it could be also a configuration error.
In, File -> Preferences -> Settings
Or
[CTRL] + [SHIFT] + P
Addendum
I realized it a little too late but like i mentioned it in my comment below, you have a misconception.
Analog to your problem:
char *FOO = "bar";
int bar = 1;
I don't think you expect the string literal "bar"
to be a reference to the variable int bar
?
Well, in your case #define FOO bar
, bar
is just a literal and has no relation to the variable bar
in your main function.
I previously thought, that you have defined bar
somewhere else and Visual Studio Code couldn't resolve it, but that's not the case.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.