12
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

library not found for -lSystem

Last updated at Posted at 2021-01-29

#library not found for -lSystem
MacOS Big Sur 11.1にアップデートをした。
g++でコンパイルすると以下のエラーが発生した。(この時VScode上では、bits/stdc++.hのincludeエラーが出ていた)

ld: library not found for -lSystem
collect2: error: ld returned 1 exit status

#解決法

brew upgrade gcc

再インストールでも大丈夫っぽい。
ちなみにこのサイトに載っていた以下の方法を先に試したが何も起きなかった。

export LIBRARY_PATH="$LIBRARY_PATH:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"

※追記
Bis Sur 11.2にアップデートしたら、普通にincludeエラーがまた発生したので、ここを参照して以下のコードを実行したら治った。

sudo rm -r /Library/Developer/CommandLineTools
xcode-select --install
12
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?