C++ Compiler and Make Utility Setup
This guide covers installing the C++ compiler (MinGW-w64) and make utility on Windows using Chocolatey package manager. These tools are essential for:
Compiling C++ examples from the Red Pitaya streaming library
Building C/C++ applications for Red Pitaya
Running Makefiles for automated build processes
FPGA project generation and builds
Note
Linux/macOS users: These tools are typically pre-installed or available through your system’s package manager (apt, yum, brew). This guide focuses on Windows installation.
Prerequisites
Windows 10/11 with administrator access
PowerShell or Windows Command Prompt
Installing Chocolatey Package Manager
Chocolatey is a package manager for Windows that simplifies software installation via command line.
Official installation guide: Chocolatey Installation Guide
Quick installation:
Open PowerShell as Administrator (right-click PowerShell → “Run as administrator”)
Run the installation command:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Wait for the installation to complete. You should see a success message.
Verify installation:
choco --version
You should see the Chocolatey version number (e.g.,
2.3.0).
Note
After Chocolatey installation, you may need to close and reopen PowerShell for the choco command to be recognized.
Installing MinGW-w64 (C++ Compiler)
MinGW-w64 provides the GCC compiler suite for Windows, including g++ for C++ compilation.
Installation via Chocolatey:
choco install mingw -y
This installs:
gcc- C compilerg++- C++ compilergdb- GNU debuggerStandard C/C++ libraries and headers
Verify installation:
g++ --version
You should see output similar to:
g++.exe (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
Test compilation:
Create a simple test file test.cpp:
#include <iostream>
int main() {
std::cout << "C++ compiler works!" << std::endl;
return 0;
}
Compile and run:
g++ test.cpp -o test.exe
.\test.exe
You should see C++ compiler works! printed to the console.
Installing Make Utility
The make utility automates build processes by reading Makefiles that define compilation rules and dependencies.
Installation via Chocolatey:
choco install make -y
Verify installation:
make --version
You should see output similar to:
GNU Make 4.4.1
Built for Windows32
Copyright (C) 1988-2023 Free Software Foundation, Inc.
Test make:
Create a simple Makefile:
hello:
@echo "Make utility works!"
Run:
make hello
You should see Make utility works! printed to the console.
Note
Makefiles require TAB characters for indentation, not spaces. Make sure your text editor is configured to use tabs when editing Makefiles.
Environment Variables
Chocolatey automatically adds the installed tools to your system PATH during installation. If the commands are not recognized:
Close and reopen your terminal/PowerShell
Check that the installation directories are in PATH:
$env:PATH -split ';' | Select-String -Pattern 'mingw|make'
If still not working, log out and log back in to Windows
Using the Tools
Compiling Red Pitaya Streaming Examples
The Red Pitaya C++ streaming examples can now be compiled:
# Navigate to examples directory
cd C:\path\to\RedPitaya-Examples\C\API_Examples\Streaming
# Compile an example
g++ -std=c++20 -o stream_adc_1.exe stream_adc_1.cpp -I..\..\..\include -L..\..\..\lib -lrp-streaming
Building with Makefiles
For projects with Makefiles:
# Build project
make
# Clean build artifacts
make clean
# Build specific target
make target_name
FPGA Project Generation
For FPGA development (see FPGA Getting Started), the make utility is used to generate Vivado projects:
# Generate FPGA project
cd C:\path\to\RedPitaya\fpga\prj\v0.94
make project
Alternative Installation Methods
Manual MinGW-w64 Installation
If you prefer not to use Chocolatey:
Download MinGW-w64 from: MinGW-w64 Downloads
Run the installer and follow the setup wizard
Manually add the
bindirectory to your system PATH:Right-click “This PC” → Properties → Advanced system settings
Click “Environment Variables”
Edit the “Path” variable under “System variables”
Add the MinGW-w64
bindirectory (e.g.,C:\mingw64\bin)
Manual Make Installation
If you prefer not to use Chocolatey:
Download Make from: GNU Make for Windows
Extract to a location like
C:\Program Files\MakeAdd the directory to your system PATH (see steps above)
Troubleshooting
Command not found after installation
Close and reopen your terminal/PowerShell
Verify PATH includes the tool directories:
$env:PATHLog out and log back in to Windows
Reboot if the issue persists
Compilation errors with streaming library
Ensure you have:
Downloaded the complete Red Pitaya streaming client package
The streaming library files (
rp-streaming.dll, headers) are accessibleCorrect include paths (
-I) and library paths (-L) in your compile command
Make complains about missing separator
This usually means spaces are used instead of tabs in the Makefile. Configure your editor to use tabs for indentation in Makefiles.
Chocolatey installation fails
Ensure you’re running PowerShell as Administrator
Check your internet connection
Try running the installation command again
Check if antivirus software is blocking the installation