Looking for IDE to compile and run C/C++ code Many beginner developers are searching for IDE to compile and run C/C++ code. Today I do not recommend an IDE to compile and run C/C++ code. Here I am talking about VS Code that is Code Editor but also behaves as an IDE with the help of Extensions. Today, In this article we will configure VS Code to compile and run C/C++ code.Disclaimer: This article is based on the Window but VSC is available for IOS and Linux. There is no such difference in configuration.
First of all, We have to download VS Studio from the official website. Download the VS Code according to your OS.
Besides this, You will need other software (MinGW) that contains the C/C++ library to compile the code. you can download it from here. After download, install that software and open it. Click mingw32-gcc-compiler and click on installation as shown in the image below.
To check whether GCC is installed in your system or not, Open your CMD and type the below code:
If you get information like below then you have successfully installed GCC in your system.
gcc (MinGW.org GCC-6.3.0-1) 6.3.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If you did not get such information you have to set Path to Environment Variable. To set the Path to Environment variable, do the following steps:
After that check again, Whether GCC is installed or not. If you got the same error then mention the error in the comment. We will resolve your issue personally. Now we move to the VS code configuration.
As I said at the beginning, VS Code behaves like an IDE after using an extension. So, the second step is to install the Extensions that will help us to compile and run C/C++ code in our VS Code.
This first extension that we will need to install is C/C++ powered by Microsoft. To download this extension, You can go to the extension center from Code > Preference > Extensions. Type C++ in the Search bar, then Install the first extension powered by Microsoft or You can simply go to this link and click on the Install button that will automatically open the VS Code and Install it automatically.
Now your VS code is ready to compile and run C/C++ code but also to obtain output in one click, We need another extension. Here, We have picked Code Runner Extension. you can download this extension from the extension center or click here to install.
After installing the Code Runner Extension, You will see the play button at the top corner of the VS Code as shown in the below image.
You will have to configure some settings for Code Runner because it compiles and run your code in the Output section where we cannot provide input. we can see the output only.
To configure settings, Do the following steps:
File -> Preferences -> Settings -> Extensions -> Find "Edit in settings.json"
You can compile and run C/C++ code in Visual studio code. If you got an error then mention in the comment, I will solve your problem personally.
I'm a web designer and developer. I have experience in PHP, WordPress, Ajax, and HTML which helps me work on both front and back end development. I have worked on over a dozen websites.
“Untitled-1.c:1: No include path in which to find iostream.h”
for the love of god, help me with this error. nothing on google helped me even after installing mingw and editing everyhing you did in your tutorial
(except these conveniences:
Before the C++ language was standardized by ISO, the header file was named as iostream.h, but when C++98 was released, It was renamed to just iostream, not with .h
Change the code to use #include instead and it should compile without any error.
The end of your tutorial needs to be more precise not sure how to get that info into setting.json file. The command reference on windows 10 does not work for me.
Thanks for the feedback. You can open settings.json from File -> Preferences -> Settings -> Extensions -> Find "Edit in settings.json" or you can search also.
plz help me
Please share your problem with us. We may help you.
after i run or click the run button – terminal says – cannot find path(path name ) it does not exist .
Running into the follow errors when running my code.
gcc.exe: error: Times: No such file or directory
gcc.exe: error: Tables.c: No such file or directory
gcc.exe: error: Tables: No such file or directory
gcc.exe: fatal error: no input files
Have not been able to find a solution. Any ideas?
Maybe GCC is not properly installed. Please check whether GCC is installed or not.
Get the latest tutorials, examples and projects updates.
Ads Blocker Detected!!!
We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.
Disable Ad Block
Want Same System