Zero Knowledge C/C++ Run Code

A powerful, fast, and user-friendly VS Code extension that allows you to run C and C++ code files directly from the context menu with a single click. No complex configuration needed - just install and start coding!
✨ Features
🚀 Quick Execution
- Right-click and Run: Run C/C++ files directly from Explorer/Editor
- Shortcut:
Ctrl+Shift+B (Cmd+Shift+B on macOS)
- Auto-save: Saves the file before compile (configurable)
🔧 Advanced Configuration
- Compilers: GCC, G++, Clang, Clang++ (auto-detect)
- Paths & Flags: Custom compiler path,
-Wall, optimization (O1/O2/O3/Os)
- Args: Extra compiler and runtime arguments
- Terminal: Per-file or single global, with auto-cleanup
🛠️ Developer Experience
- Cross-platform: Windows, macOS, Linux
- Real-time Checks: Live
scanf “missing &” diagnostics with precise underline
- Inline Suggestion: Copilot-style
scanf(...) suggestion after int/float/double/char declarations
- Snippets: Handy C/C++ templates
📱 Terminal Options
- Per-File or Global terminals
- Auto-cleanup option
📋 Requirements
System Requirements
- VS Code: Version 1.60.0 or higher
- Compiler: GCC/G++ or Clang/Clang++ installed and available in PATH
- Platforms: Windows, macOS, Linux
Compiler Installation
Windows
# Using Chocolatey
choco install mingw
# Or download from: https://www.mingw-w64.org/
macOS
# Install Xcode Command Line Tools
xcode-select --install
# Or install Homebrew and GCC
brew install gcc
Linux (Ubuntu/Debian)
sudo apt update
sudo apt install build-essential gcc g++
Linux (Fedora/RHEL)
sudo dnf install gcc gcc-c++
# or
sudo yum install gcc gcc-c++
🚀 How to Use
- Right-click on any
.c or .cpp file in the Explorer or Editor
- Select "Run C/C++ Code" from the context menu
- Your code will compile and execute in a dedicated terminal
Method 2: Keyboard Shortcut
- Open a C/C++ file
- Press
Ctrl+Shift+B (Windows/Linux) or Cmd+Shift+B (macOS)
Method 3: Code Snippets
Use built-in snippets for quick code structure:
- C: Type
cmain + Tab for main function template
- C++: Type
cppmain + Tab for main function template
- Additional snippets:
cfor, cwhile, cif, cifelse, cswitch, cfunc, cppclass, cppvector, etc.
⚙️ Configuration
Open Settings (Ctrl+,) and search for “C/C++ Run Code”.
Terminal & Build (Grouped, end of Settings)
{
"run-c-code.closePreviousTerminals": false, // order 100
"run-c-code.useNewTerminalPerFile": true, // order 101
"run-c-code.useBuildFolder": true, // order 102
"run-c-code.saveFileBeforeRun": true // order 103
}
Compiler Configuration
{
"run-c-code.compilerType": "auto", // auto, gcc, g++, clang, clang++
"run-c-code.compilerPath": "", // Custom compiler path
"run-c-code.enableWarnings": true, // Enable -Wall warnings
"run-c-code.optimizationLevel": "none", // none, O1, O2, O3, Os
"run-c-code.additionalCompilerArgs": "", // Extra compiler flags
"run-c-code.runArgs": "" // Runtime arguments
}
Developer Features
{
"run-c-code.enableSyntaxCheck": false, // Enable scanf & checking
"run-c-code.saveFileBeforeRun": true // Auto-save before run
}
Gemini AI Features (Experimental)
1. Text Improvement
{
"run-c-code.experimental.enableGeminiRefactor": false, // Toggle AI features
"run-c-code.geminiApiKey": "", // Your API key
"run-c-code.geminiModel": "gemini-2.5-flash-lite", // Default model
"run-c-code.geminiOutputLanguage": "english", // Output language (english/bangla)
"run-c-code.geminiLineLength": 76, // Max characters per line
"run-c-code.geminiExtraRules": "" // Additional custom rules
}
- Shortcut: Ctrl+Alt+E (macOS: Cmd+Alt+E) on selected text
- Supports: C, C++, Python, and
.txt files
- Language Support: Choose between English or Bangla (বাংলা) output
- Line Length: Set maximum characters per line (default: 76)
2. Smart Variable Renamer 🆕
Example (Quick Fix Mode):
// Before - you'll see blue underline under 'x' and 'calc'
int x = 10;
float y = calc(x);
// Click 💡 lightbulb → "Rename 'x' to 'student_count'"
// After one click
int student_count = 10;
float average_score = calculate_average(student_count);
Settings:
{
"run-c-code.variableRenamerMode": "quickFix" // or "quickPick"
}
- Models available (RPD):
gemini-2.0-flash (200), gemini-2.0-flash-lite (200), gemini-2.5-flash-lite (1k, default), gemma-3-2b (14k), gemini-2.5-flash (250).
Arguments & Optimization (Together)
Control runtime args, extra compiler flags, and optimization in one place.
{
"run-c-code.runArgs": "",
"run-c-code.additionalCompilerArgs": "",
"run-c-code.optimizationLevel": "none"
}
See more
English
Run-c-code: Run Args: Command line arguments passed to your executable at runtime.
- Example:
"run-c-code.runArgs": "-n 10 --verbose input.txt"
- Windows run:
& ".\\build\\your.exe" -n 10 --verbose input.txt
- macOS/Linux run:
./build/your -n 10 --verbose input.txt
Run-c-code: Additional Compiler Args: Extra compiler flags appended to the compile command.
- Examples:
- C standard:
"-std=c11"
- Debug + macro:
"-g -DDEBUG"
- Include path:
"-Iinclude"
- Resulting command (illustrative):
gcc file.c -Wall -O2 -std=c11 -g -DDEBUG -Iinclude -o build/file.exe
Run-c-code: Optimization Level: Chooses the compiler optimization level.
- Values:
none, O1, O2, O3, Os
- Example:
"run-c-code.optimizationLevel": "O2" → adds -O2 during compilation.
বাংলা
Run-c-code: Run Args: আপনার প্রোগ্রাম রান করার সময় যে আর্গুমেন্টগুলো পাস হবে।
- উদাহরণ:
"run-c-code.runArgs": "-n 10 --verbose input.txt"
- Windows:
& ".\\build\\your.exe" -n 10 --verbose input.txt
- macOS/Linux:
./build/your -n 10 --verbose input.txt
Run-c-code: Additional Compiler Args: কম্পাইল কমান্ডে অতিরিক্ত ফ্ল্যাগ যোগ করে।
- উদাহরণ:
- C স্ট্যান্ডার্ড:
"-std=c11"
- ডিবাগ + ম্যাক্রো:
"-g -DDEBUG"
- ইনক্লুড পাথ:
"-Iinclude"
- কমান্ড (উদাহরণ):
gcc file.c -Wall -O2 -std=c11 -g -DDEBUG -Iinclude -o build/file.exe
Run-c-code: Optimization Level: কম্পাইলারের অপ্টিমাইজেশন লেভেল ঠিক করে।
- অপশন:
none, O1, O2, O3, Os
- উদাহরণ:
"run-c-code.optimizationLevel": "O2" দিলে কম্পাইলের সময় -O2 যুক্ত হবে।
Build Folder Behavior
By default, executables are created in a build/ subfolder beside the source and run from the parent directory.
{
"run-c-code.useBuildFolder": true // Compile to build/ and run as ./build/<exe>
}
When disabled (false), the executable is created and run in the same folder as the source (legacy behavior).
📥 Installation
From VSIX (Recommended)
- Download
zero-knowledge-c-run-code-0.1.6.vsix
- Open VS Code
- Press
Ctrl+Shift+P (Command Palette)
- Type "Install from VSIX" and select
- Choose the downloaded
.vsix file
From Source
git clone https://github.com/masudranaxpert/zero-knowledge-c-run-code.git
cd zero-knowledge-c-run-code
npm install
npm run package
# Install the generated .vsix file
From VS Code Marketplace
Coming soon - submit to marketplace
🐛 Troubleshooting
Compiler Not Found
Error: 'gcc' is not recognized as an internal or external command
Solution: Install GCC and ensure it's in your PATH
# Check if GCC is installed
gcc --version
# Add to PATH (Windows)
set PATH=%PATH%;"C:\MinGW\bin"
# Add to PATH (Linux/macOS)
export PATH=$PATH:/usr/local/bin
Permission Issues (Linux/macOS)
chmod +x your_program
Terminal Doesn't Open
- Check VS Code terminal settings
- Try restarting VS Code
- Verify extension is enabled
📝 Release Notes
0.1.6
- 🆕 Smart Variable Renamer: AI-powered tool to suggest better variable/function names
- Quick Fix Mode (💡): Shows blue underlines with lightbulb suggestions (default)
- Quick Pick Mode: Classic menu-based selection
- One-click rename with
WorkspaceEdit
- 🆕 Text File Support: Gemini refactor now works with
.txt files
- 🆕 Language Selection: Choose between English and Bangla (বাংলা) output
- 🆕 Line Length Control: Set maximum characters per line (default: 76)
- 🛠️ Enhanced Formatting: Better multi-line comment and text formatting
- 🌐 Bilingual Support: Full support for English and Bangla (বাংলা)
- ⌨️ New Shortcut:
Ctrl+Alt+R for Smart Variable Renamer
- 🎯 Professional UX: In-context diagnostics and code actions
0.1.5
- 🆕 Gemini AI Integration: Experimental text refactoring feature
- 🛠️ Multiple Models: Support for various Gemini models
- 🔧 Custom Rules: Add your own refactoring rules
0.1.3
- 🆕 Build Folder Output: Compiles into
build/ subfolder and runs via build/<exe>
- 🛠️ Setting: Toggle behavior with
run-c-code.useBuildFolder (default: true)
0.1.2
- 🆕 C++ Support: Full C++ file support with
g++
- 🆕 Multi-Compiler: Support for GCC, G++, Clang, Clang++
- 🆕 Terminal Management: Per-file terminals with cleanup options
- 🆕 Code Snippets: Built-in C/C++ code templates
- 🆕 Syntax Checking: Real-time
scanf error detection
- 🆕 Cross-platform: Improved Windows, macOS, Linux compatibility
- 🆕 Advanced Settings: Compiler flags, optimization, custom arguments
0.1.1
- 🆕 C++ Basic Support: Initial C++ file detection
- 🆕 Compiler Configuration: Basic compiler type selection
- 🆕 Terminal Options: Global vs per-file terminal modes
- 🆕 Auto-save: Save files before compilation
0.0.1
- 🚀 Initial release
- ✅ C file support with GCC
- ✅ Right-click context menu
- ✅ Keyboard shortcut (Ctrl+Shift+B)
- ✅ Terminal integration
- ✅ Auto-save feature
🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature)
- Commit your changes (
git commit -m 'Add amazing feature')
- Push to the branch (
git push origin feature/amazing-feature)
- Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Built with ❤️ for the C/C++ developer community
- Thanks to all contributors and testers
📞 Support & Feedback
Happy Coding with Zero Knowledge C/C++ Run Code! 🎉
