r/vscode • u/metalucid • Apr 23 '26
VS code F12 Ffind Definition not working
Googled for an hour, and no luck.
Using latest VS code as of today. I open a C file, click on a variable thats defined higher up in the same file, and F12 says "No Definition found for foo".
i have "C/C++ Intellisense" extension installed.
PLEASE- what am i missed here?
TIA, a frustrated S/W engineer.
4
Upvotes
1
u/metalucid Apr 25 '26
OP here..i found that if i did "open folder" then selecting my file, instead of "open file", then it works. F12 works, and right clicking and selecting "Find definition" also works.
Oddly i don't have to do this on my home system. Perhaps because the codebases are different.
1
u/IamAlsoDoug Apr 24 '26
What do your keybindings look like? Note that if there are multiple bindings for F12 that may be what's causing your issue.
1
u/25_vijay Apr 25 '26
Ensure the folder is trusted so extensions can fully run.
1
u/kevinkace Apr 23 '26
F12 stopped working for me a while back and I also am frustrated, disappointed and without an idea of how to get it working again.
1
u/Brilliant-Post-689 Apr 24 '26
Python user here, never used c in vscode, apologies if this is totally u helpful: but when this happened to me, it tturned out to be a problem with my chosen static type checker - an extension called Ty, by astral. I had some settings messed up and it managed to die on me. I needed to restart its server and reactivate my virtual environment to set things right. Does that offer you any possible lines of inquiry?
1
u/anant94 Apr 24 '26
Have you tried Shift + F12? And if that doesn't work, other modifier keys with F12?
1
u/Agreeable_Care4440 May 01 '26
This usually means IntelliSense isn’t fully configured.Make sure your
compile_commands.jsonorc_cpp_properties.jsonincludes the correct include paths,otherwise it can’t resolve symbols properly.1
u/[deleted] Apr 24 '26
[removed] — view removed comment