Home >Backend Development >C++ >Import
library in C on Mac" />
If you’re coding in C (which I highly doubt, but if you are!) and you see many people importing
1.first step is to install ncurses, if you already did skip this step.
brew install ncurses
2.locate where the library is installed
brew info ncurses
3.The output will include where the library is installed something like:
/opt/homebrew/Cellar/ncurses/6.5
remember your version like mine is 6.5
4.Verify for the libraries and headers:
ls /opt/homebrew/Cellar/ncurses/6.5/lib ls /opt/homebrew/Cellar/ncurses/6.5/include
remember to change your version
gcc main.c -o main -I/opt/homebrew/Cellar/ncurses/6.5/include -L/opt/homebrew/Cellar/ncurses/6.5/lib -lncurses
replace version
export CPPFLAGS="-I/opt/homebrew/Cellar/ncurses/6.5/include" export LDFLAGS="-L/opt/homebrew/Cellar/ncurses/6.5/lib"
replace version number
7.Now you can compile your file using :
gcc main.c -o main -lncurses
The above is the detailed content of Import