dev-resources.site
for different kinds of informations.
How to Fix the 'argp.h' Not Found Error on macOS
Published at
7/24/2024
Categories
Author
kojix2
Categories
1 categories in total
open
When compiling a Linux-oriented tool written in C/C++ on macOS, you might encounter the following error:
fatal error: 'argp.h' file not found
#include <argp.h>
^~~~~~~~
1 error generated.
This means that the library for parsing command-line arguments, argp.h
, is missing.
Solution
Fortunately, you can install this library using Homebrew.
brew install argp-standalone
After installing, verify the files:
brew ls argp-standalone
/opt/homebrew/Cellar/argp-standalone/1.3/include/argp.h
/opt/homebrew/Cellar/argp-standalone/1.3/lib/libargp.a
/opt/homebrew/Cellar/argp-standalone/1.3/sbom.spdx.json
Since there is no .pc
file, you can't use pkg-config
. Instead, you need to specify the paths directly.
cc hoge.c \
-largp \
-L /opt/homebrew/Cellar/argp-standalone/1.3/lib/ \
-I /opt/homebrew/Cellar/argp-standalone/1.3/include/ \
-o hoge
With these steps, you should be able to resolve the issue of missing argp.h
on macOS.
Articles
12 articles in total
Wombat - Syntax Highlighting with Rust's Bat Called from Crystal
read article
Scan Your Linux Disk and Visualize It on Mac with GrandPerspective
read article
One-Liner for Finding Typos
read article
How to Fix the 'argp.h' Not Found Error on macOS
currently reading
Mixing FFI, Fiddle, and C Extension in Ruby
read article
Using Ruby with Condaπ
read article
Calling Deepl's API from the Crystal language
read article
Calling the ChatGPT API interactively from Crystal language
read article
Calling OpenAI API from Crystal Language
read article
Act like a cat! - Calling the OpenAI API from Ruby
read article
Tried Polars in Ruby
read article
Meld, a GUI tool for diffing, in the Age of ChatGPT
read article
Featured ones: