-1
  1. How to run a C file in Visual Studio without:
    • having error message #include stdio.h cannot open source file; and
    • not download mingw for Visual Studio Code?

1 Answers1

1
  1. Download Visual Studio Code & make sure you install C/C++ & C/C++ Extension Pack in extensions

  2. Go to Remote Explorer -> Select Connect to WSL (https://i.stack.imgur.com/fLVNw.png)

  3. Go to File -> Open Folder -> enter C directory /mnt/c

  4. Enter Ctrl + Shift + P -> Type configurations -> Select (UI) -> Enter /usr/bin/gcc in Complier Path

  5. Lastly, BE VERY SURE to set IntelliSenseMode to linux-gcc-x64 or any x64 compiler instead of x86 because x64 is for 32-bit compilers while x84 is for 64-bit compilers which gcc in Ubuntu workspace might not support. (https://i.stack.imgur.com/qT8zU.png)

  6. Voila! There should not be any squiggle lines afterwards.

Please Vote this answer if it helped you!