Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code: Unable to open 'MyFile.h': File not found

I got this kind of errors when attempting to go to the declaration of some attributes/methods (using ctrl/cmd + left click):

Unable to open 'MyFile.h': File not found

probably this happens because the file MyFile.h has been moved recently.

like image 655
Francesco Borzi Avatar asked Sep 03 '16 11:09

Francesco Borzi


People also ask

Can't open file error VS Code?

For resolving this issue, I closed the VSCode and again imported folder again as Path of folder got changed in mine conditions. If this doesn't work, you can uninstall VSCode and then reinstall it. Show activity on this post. I hope this helps.

Why terminal is not opening in VS Code?

Some terminal launch failures may be due to your shell installation and are not specific to VS Code. The exit codes displayed come from the shell and you may be able to diagnose shell issues by searching on the internet for the specific shell and exit code. Use the most recent version of VS Code.

How do I fix Visual Studio Code not working?

you can fix this issue by selecting run this program as administrator under compatibility tab. Show activity on this post. If you are on win10, kill all vscode processes, delete folder 'C:\Users\xxx\AppData\Roaming\Code', and launch vscode again.

How do I enable extensions in Visual Studio Code?

You can browse and install extensions from within VS Code. Bring up the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of VS Code or the View: Extensions command (Ctrl+Shift+X). This will show you a list of the most popular VS Code extensions on the VS Code Marketplace.


1 Answers

I solved this problem by forcing VSCode to re-scan the project structure.

In order to do that, I closed VSCode, deleted the .vscode hidden folder of my project, and opened it again.

like image 90
Francesco Borzi Avatar answered Oct 01 '22 17:10

Francesco Borzi