Installing and running language C in VS Code with MinGw.
C in VS code with MinGW
Firstly, You should download and install VS code and then install some extensions like "C/C++, C/C++ extension pack and most importantly, install code runner with the ".run" logo (You can refer this blog on a full installation guide).
Then after setting all these stuffs, we have to install a compiler, that is MinGW from website. After downloading install the compiler of C and C++ by selecting GCC for C and G++ for C++. Wait for 5 minutes as the installation takes a while to install completely in you system. After completion, click close and open file Explorer, Go to C Drive and look for MinGW > Bin and copy the path. Then search for Edit Environment Variable for you account in the windows search bar, select Path in the user variable option, now click on edit, click on new and paste the path you just copied, click ok, and close the window. Now, to validate your installation, go on CMD and run the given commands one by one "gcc --version" and "g++ --version". This should give version information and it insures the installation. Open VS code and click "Ctrl + ,", this will open up the VS Code Setting tab, start typing "run in terminal" after it, all the options will be available to configure code runner, you will get a option to "Whether to run code in integrated terminal" check the box beside it and you are ready to go!!
Writing your first C code
After you are all done with setting up MinGW and configuring the C compiler, let's write a code:
#include<stdio.h>int main(){printf("Hii, how are you");return 0;}
Copy this whole code and paste it into your VS Code and congrats! you just wrote your first code of C.
Comments
Post a Comment