Search code examples
c++macos-mojavepybind11

Pybind11 doesn't work or C++ doesn't compile after upgrading to Mojave: -lstdc++ not found


I was able to install the pybind11 example here before I upgraded my MacOS. However, after I upgraded my MacOS to Mojave, when I compile the same example on that link, I see the following error:

clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'g++' failed with exit status 1

Am I missing a linker command? I've searched online but couldn't find a solution.


Solution

  • I actually found the answer. I only needed to do

    export MACOSX_DEPLOYMENT_TARGET=10.9

    The installation went smoothly.