Instead of permanently altering the Windows System Environment Variables, use a localized batch script to load the compiler on demand. Navigate to your root portable folder. Create a new text file named portable-shell.bat . Open the file in a text editor and add the following lines:
This introduces a risk factor:
You can extract it and "just go," making it ideal for university projects or work on computers where you cannot install software. mingw portable
@echo off SET PATH=%~dp0mingw64\bin;%PATH% echo MinGW Portable Environment Activated! echo GCC Version: gcc --version cmd /k Use code with caution.
: Runtime libraries to interface with native Windows environments. Key Advantages of Going Portable Open the file in a text editor and
Whether your projects require like OpenCV, SDL2, or Boost The specific version of GCC your project requires
generally refers to a version of the MinGW (Minimalist GNU for Windows) compiler suite that has been packaged to run without a formal installation process. It is designed to be extracted to a USB drive or a subfolder and executed from any location without modifying the Windows Registry or requiring administrative privileges. : Runtime libraries to interface with native Windows
If compiled programs fail to execute on other computers, append the static linking flags -static -static-libgcc -static-libstdc++ during compilation. This bakes the required runtime libraries directly into your executable file.
Configure a custom execution script within NppExec to call your portable g++.exe and run the resulting binary instantly. Best Practices and Troubleshooting