找不到符号:__ZTINSt3__112bad_weak_ptrE

Symbol not found: __ZTINSt3__112bad_weak_ptrE

我刚开始 Ruby 游戏开发,作为初学者我对 gosu 的属性很不确定。虽然 运行 game.rb 我遇到了以下问题:

Traceback (most recent call last):
    3: from game.rb:1:in `<main>'
    2: from game.rb:1:in `require'
    1: from /Users/xyz/.rvm/gems/ruby-2.6.3/gems/gosu-0.14.5/lib/gosu.rb:25:in `<top (required)>'
/Users/xyz/.rvm/gems/ruby-2.6.3/gems/gosu-0.14.5/lib/gosu.rb:25:in `require': dlopen(/Users/xyz/.rvm/gems/ruby-2.6.3/gems/gosu-0.14.5/lib/gosu.bundle, 9): Symbol not found: __ZTINSt3__112bad_weak_ptrE (LoadError)
  Referenced from: /Users/xyz/.rvm/gems/ruby-2.6.3/gems/gosu-0.14.5/lib/gosu.bundle
  Expected in: /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox
 in /Users/xyz/.rvm/gems/ruby-2.6.3/gems/gosu-0.14.5/lib/gosu.bundle - /Users/xyz/.rvm/gems/ruby-2.6.3/gems/gosu-0.14.5/lib/gosu.bundle

将我的 macOS 更新到 Mojave 后,我遇到了类似的问题。

重新安装 Xcode 命令行工具 为我解决了问题:

sudo rm -rf /Library/Developer/CommandLineTools

xcode-select --install

按照弹出的指示,重启终端。