"Bringing desktop-grade C++ compilation directly to your browser."
| Attribute | Details |
|---|---|
| Name | C++ Online Compiler |
| Version | v1.0.0 |
| Status | 🟢 Active |
| Type | Web-based IDE |
| Primary Language | Python |
| Target Compiler | g++ (C++17) |
| License | MIT |
| Author | prithishmisra23 |
C++ Online Compiler is a lightweight, web-based Integrated Development Environment (IDE) built entirely in Python using Streamlit. It allows users to write, compile, and execute C++ code in a secure, sandboxed environment directly from their browser, complete with custom CSS styling to mimic professional IDEs.
| User Type | Core Use Case |
|---|---|
| Students | Quickly testing algorithms and assignments without local setup. |
| Instructors | Demonstrating C++ concepts in live environments. |
| Developers | Scratchpad for testing C++17 features on the go. |
❌ Before C++ Online IDE:
- Cumbersome local setup required for g++ and MinGW.
- Difficulty sharing code snippets that compile reliably.
- Heavy IDEs taking up gigabytes of disk space.
✅ After C++ Online IDE:
+ Zero-configuration cloud compilation.
+ Instant execution with standard input/output support.
+ Lightweight, beautifully styled interface accessible anywhere.Purpose: To lower the barrier to entry for systems programming by providing an accessible, instant C++ environment.
| Principle | Application |
|---|---|
| Simplicity | A single app.py architecture that is easy to deploy and scale. |
| Security First | utilizing tempfile and subprocess sandboxing to prevent host compromise. |
| Aesthetic UX | Custom CSS overriding default Streamlit styles for a true "Dark Mode" IDE feel. |
| Feature | Status | Description |
|---|---|---|
| Multi-File Support | 🟢 Live | Manage and compile multiple .cpp and .h files simultaneously. |
| Sandboxed Execution | 🟢 Live | Safe code execution with timeout limits to prevent infinite loops. |
| Custom Input | 🟢 Live | Provide stdin directly via the UI for algorithmic testing. |
| Real-time Compilation Logs | 🟢 Live | Detailed g++ output and error tracing. |
flowchart TD
A[Open IDE] --> B[Write C++ Code]
B --> C{Provide Input?}
C -->|Yes| D[Enter Stdin]
C -->|No| E[Compile Code]
D --> E
E --> F{Compilation Success?}
F -->|Yes| G[Execute Binary in Sandbox]
F -->|No| H[Display Compiler Errors]
G --> I[Show Output & Execution Time]
graph TB
UI[Streamlit Frontend] --> App[app.py Logic]
App --> FS[Temp File System]
App --> GCC[g++ Compiler]
GCC --> Bin[Executable (a.out)]
Bin --> App
App --> UI
| Layer | Technology | Purpose |
|---|---|---|
| Frontend UI | Streamlit, Custom CSS | Rapid web UI development with a bespoke IDE theme. |
| Backend Logic | Python 3, subprocess |
Handling state, compiling, and executing binaries securely. |
| Compiler | GNU C++ Compiler (g++) |
Compiling C++17 standard code. |
-
Ensure Dependencies are Installed: You must have
g++installed and accessible in your system's PATH. -
Clone the repository:
git clone https://github.com/prithishmisra23/cpp-online-compiler.git cd cpp-online-compiler -
Install Python dependencies:
pip install -r requirements.txt
-
Run the IDE:
streamlit run app.py
| Component | Status | Recommendation |
|---|---|---|
| Execution Sandbox | 🔒 Secured | Uses tempfile.TemporaryDirectory for isolated compilation. |
| Timeout Limits | 🔒 Secured | Subprocess timeouts prevent infinite loop DOS attacks. |
| System Calls | C++ code can technically make system calls. Consider Docker for production. |
gitGraph
commit id: "Initial Commit"
branch feature/streamlit-ui
checkout feature/streamlit-ui
commit id: "Add custom CSS"
checkout main
merge feature/streamlit-ui
branch feature/secure-compiler
checkout feature/secure-compiler
commit id: "Add subprocess timeout"
checkout main
merge feature/secure-compiler tag: "v1.0.0"