C++エラーメモ

エラー内容

環境:MacOS Mojave 文字列を出力するだけのC++のコードをコンパイル

 > g++ -std=gnu++11 sample.cpp

とすると、以下のwarningが出る

warning: section "__textcoal_nt" is deprecated.section __TEXT,__textcoal_nt,coalesced,pure_instructions

他にもたくさん出た。./a.outを実行したら以下のようなエラーが出る。

dyld: lazy symbol binding failed: Symbol not found

対処

いろいろ検索したら、rootlessが原因じゃないかとか言う記事があるが、リカバリーモードで起動するのが面倒でスルー。

ruby on rails - dyld: lazy symbol binding failed: Symbol not found: エラー - スタック・オーバーフロー

OS X 10.11 El Capitanのシステム保護機能「Rootless」を無効にするcsrutilコマンドの使い方。 | AAPL Ch.

結局、g++-7コンパイルしたら問題が起きなくなった。