0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

M1 MacでのC++環境構築

Posted at

はじめに

M1で環境構築するにあたって、以下の既存のページを見ると、M1 Macでは少し違う部分があったので、備忘録用にまとめてみます。

参考ページ:
https://qiita.com/pinoccio11/items/767a8738d8fa8bba2f81

参考ページについて、M1 Macで設定・記述が異なる部分についてだけ記述しています。
基本的には参考ページの流れ通りでOKかと思います。

シンボリックリンク配置先

M1 Macなので、シンボリックリンクの配置先は/opt/homebrew/binになっている。

実行時のコマンド

実行時には、以下のようなコマンドを打つ必要あり。
(以下のようにしないと、g++-14コンパイラがassert.hヘッダーファイルを見つけられない。この問題は、MacOSのアップデート後によく発生し、システムヘッダーファイルの場所が変更されたことが原因)

g++-14 -isysroot $(xcrun --show-sdk-path) test.cpp && ./a.out

Code runner Json設定

Code runnerのJson設定において

"cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",

となっていたものを

"cpp": "cd $dir && g++-14 -isysroot $(xcrun --show-sdk-path) $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",

に変更

これでできるはず...!

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?