Or take a step back: Do you need specifically g++, or do you need "a C++ compiler"? FreeBSD base uses LLVM/clang, not gcc, and of course a C++ compiler (clang++
) is included.
The generic name to invoke the platform's C++ compiler is just c++
(so on FreeBSD it will invoke clang++, while on a system using GCC as the default, it will invoke g++). It's normally advised to use your platform's default compiler unless you know you need a different one (and why). There are more things to consider then, like setting the correct rpath
so the compiled binaries find the correct runtime libraries (those of GCC).