Recently I wanted to profile my cpp code and came across gperftool, but there aren't really clear instructions on how to use it with Mac. So far I have run brew install gperftools
and wanted to compile my simple cpp file which just outputs "Hello world!". I run g++ main.cpp -lprofiler -o main
but get error ld: library not found for -lprofiler
. I really appreciate it if you could guide me or should me a tutorial where it's easy to follow. Thanks :)
Edit: Currently I am using MacOS with new M1 chip (not sure if that can cause any issue)
So brew didn't install the binaries and that's it.
Follow these steps if you are having a hard time making it work
/usr/local/lib
)