How to Run C and C++ Program in Sublime Text
How to Run C and C++ Program in Sublime Text
It is a very popular and widely used text editor by programmers and
developers. Just follow below steps to configure sublime text to compile
and run C and C++ programs. I have tested the steps in sublime text 3
but I am sure it will work for any other version also.
How to Run C and C++ Program in Sublime Text
Here I consider that you have installed GCC compiler on your system.
Part 1: Adding Path in Environment Variables
1. Copy the path of bin folder of GCC compiler. In my case the path looks like as shown below, it may be different in your case.
C:\Program Files (x86)\CodeBlocks\MinGW\bin
2. Now right click on Computer and select Properties. Then click on Advance system settings and after that click on Environment Variables.
3. In the next window under System variables find a variable with name Path. Select it and click on Edit button.
4. In Variable value text field go to end and then type semicolon and then paste the path of bin folder that you copied. See below screenshot.
5. Finally click on all OK buttons to save the settings.
Part 2: Configuring Sublime Text
Open sublime text and go to Tools > Build System > New Build System and then paste the following lines in it.
For C:
{
"shell_cmd" : "gcc $file_name -o ${file_base_name}",
"working_dir" : "$file_path",
"variants":
[
{
"name": "Run",
"shell_cmd": "gcc $file_name -o ${file_base_name} && ${file_path}/${file_base_name}"
}
]
}
Press ctrl+s and then save it with file name C_RUN.
For C++:
}
For C++:
{
"shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run",
"shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\""
}
]
}
Press ctrl+s and then save it with file name CPP_RUN.
For running a program go to Tools > Build With and then select C_RUN – Run or CPP_RUN – Run according to the language you are using.
For running a program go to Tools > Build With and then select C_RUN – Run or CPP_RUN – Run according to the language you are using.
ReplyDeleteVery Good writing,
wincracker.com
Sublime Text 4 Build Crack
IPVanish Crack
Kon-Boot Crack
Gather Proxy Premium Crack
WinISO Crack
Thanks for shearing this kind of information sublime
ReplyDeleteReally Good Work Done By You...However, stopping by with great quality writing, it's hard to see any good blog today.../
ReplyDeleteIObit Uninstaller Pro Crack
Sandbox Crack
Hyper Snap crack
Editor Em Professional Crack
Thank you so much for all of your efforts. I'm grateful for it, and I'm grateful for you sharing it with me.
ReplyDeleteText Sublime Build Crack
I appreciate all of your efforts, and I appreciate you sharing them with us.
ReplyDeleteText Sublime Build
Windows 10 Product Crack
Google Chrome Crack
auslogics-file-recovery
softperfect-ram-disk