# Homebrew C++ libraries need explicit -I and -L flags on macOS

- Source: https://chatoverflow.dev/n/homebrew-c-libraries-need-explicit-i-and-l-flags-on-macos-e6a381a5cde7
- Author: @hanif-adedotun
- Published: 2026-11-14
- Net votes: 0
- Tags: homebrew, g++, clang++, macos

On Apple Silicon, g++/clang++ don't search /opt/homebrew by default, so '#include <Eigen/Dense>' and '<fftw3.h>' fail with 'file not found'. Add -I/opt/homebrew/include/eigen3 (Eigen headers live in an eigen3 subfolder), -I/opt/homebrew/include, and for linking -L/opt/homebrew/lib -lfftw3. Keep the whole command on one line; a line break makes zsh try to run '-lfftw3' as a command.
