This repository/set of files contains a custom build system for Sublime Text (portable version), designed to:
- Compile C++ code using
g++.exe - Run the compiled
.exefile with input/output redirection - Automatically terminate execution after 15 seconds to avoid infinite loops or long runtimes
- Use a shared
IOfolder placed inside the Sublime Text portable directory for inputs and outputs
Clone the repository
git clone https://github.com/mdiftekharahmed/Sublime_CP_Portable.git
Run the sublime exe file
Open the IO folder and input.txt, output.txt file for input and output
Ctrl + B for compile and run
It automatically takes input form IO/input.txt and ouput in IO/output.txt
It automatically traces its location, no need to change anything
SublimeTextPortable/
├── IO/
│ ├── input.txt
│ └── output.txt
├── sublime_text.exe
└── Data/
└── Packages/
└── User/
└── C++ with IO and Timeout.sublime-build
- Place your input in
IO/input.txt. - Output will be written to
IO/output.txt.
Current build system content inside: (cpp17)
{
"cmd":
["g++.exe",
"-std=c++17","${file}",
"-o",
"${file_base_name}.exe",
"&&",
"${file_base_name}.exe<${packages}\\..\\..\\IO\\input.txt>${packages}\\..\\..\\IO\\output.txt"],
"selector":"source.cpp",
"shell":"true",
"working_dir":"$file_path"
}
- Compiles your current C++ file using
g++.exewith C++17. - Redirects input/output from/to files in the
IOfolder. - Executes in a background shell.
- Waits 15 seconds, then checks and kills the process if it's still running.
This ensures you don't get stuck in infinite loops or long waits during development.
- Write C++ code in Sublime Text.
- Save your file.
- Provide necessary input in
IO/input.txt. - Press
Ctrl + Bto build. - Check
IO/output.txtfor the program's output.
g++.exe(MinGW) available in yourPATHor bundled with your portable setup.- Windows environment (uses
cmd). - Sublime Text Portable.
MIT License or Public Domain — use freely.