I tried to run a C program on sublime text 3 with MinGW open source software development environment.
These are the steps I followed.
Step 1. Copy C:\MinGW\bin
Step 2. Set path variable by going into Advanced system settings then into environment’s variable adding a new path as shown in the picture.
Step 3. Then I clicked ok on the remaining option choices.
Step 4. After that uploaded the build file code for C which is,
{
"cmd" : “gcc $file_name -o ${file_base_name} && ${file_base_name}”,
"selector" : “source.c”,
"shell": true,
"working_dir" : "$file_path"
}
Step 5. This is the code I obtained from the description of a YouTube video whose link is https://www.youtube.com/watch?v=SkK7hp_ZVJ0.
Step 6. Saved the build file with JSON data type extension with acceptance for sublime build files then tried to run a program.
#include<stdio.h>
void main()
{
printf("\n Helloworld!");
}
Step 7. The error obtained was,
‘gcc’ is not recognized as an internal or external command,
operable program or batch file.
[Finished in 0.4s with exit code 1]
[cmd: gcc hello1.c -o hello1 && hello1]
[dir: C:\Users\Trinayan\AppData\Roaming\Sublime Text 3\Packages\User]
[path: C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\Intel® Management Engine Components\DAL;C:\Program Files\Intel\Intel® Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel® Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel® Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;c:\Program Files\Intel\WiFi\bin;c:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files\Microsoft VS Code\bin;C:\Users\Trinayan\Anaconda3;C:\Users\Trinayan\Anaconda3\Library\usr\mingw-w64\bin;C:\Users\Trinayan\Anaconda3\Library\bin;C:\Users\Trinayan\Anaconda3\Scripts;C:\Users\Trinayan\AppData\Local\Microsoft\WindowsApps;c:\Program Files\Intel\WiFi\bin;c:\Program Files\Common Files\Intel\WirelessCommon;]
Step 7. Note, the link to the MinGW installer was provided in the Youtube video whose link is mentioned above in step 5.
Step 8. Please help me solve my problem to run this and further any type of C program in Sublime text mentioned version.