-4

What does No such file or directory mean? P.S - I am new to VS code

I tried to run it and its showing the above problem. What should be done? can anyone help a bit? cout is also not showing in suggestions. I installed Code runner and c/c++ extension

rioV8
  • 24,506
  • 3
  • 32
  • 49
  • 3
    Avoid blank characters in pathnames or enclosed these with double quotes (`"`). – πάντα ῥεῖ Aug 06 '23 at 15:54
  • 1
    is your source file called `firstprogram` with no extension? if so you're using the same file for both your sourcecode and executable, I'm guessing the first thing gcc does is delete its output file, then when it looks for the source file it doesn't exist. I'd recommend following the microsoft tutorial for setting up vs code: https://code.visualstudio.com/docs/cpp/config-mingw or even better just use visual studio instead, its much more beginner friendly and comes with everything you need built in and pre-configured – Alan Birtles Aug 06 '23 at 15:56
  • 1
    ***What should be done?*** Remember to never use a space in a path for the `c` or `c++` languages. Remember that these languages are compiled on the command line or shell and that on the command line a space separates different arguments forcing you to have to quote the path. The problem is the quoting is not always automatic and does not always work correctly causing problems like you have now. – drescherjm Aug 06 '23 at 16:01
  • My second piece of advice for VSCode is to follow the official documentation. Many people skip that and instead install a very old compiler and also have a lack of understanding of the 3 important json files. – drescherjm Aug 06 '23 at 16:06
  • 1
    The white dot next to the filename indicates that the file has not been saved to disk. VS Code defaults to not saving changes before compiling, but rather compile an older version (if there is one). This setting can also be changed as part of the complete setup. – BoP Aug 06 '23 at 18:10
  • why not do a search here on SO for the error message, preferable a text search, and you will find that almost all VSC and c++ questions are about this issue – rioV8 Aug 06 '23 at 20:42

0 Answers0