LoginSignup
0
0

More than 3 years have passed since last update.

【備忘録】コンパイルの基本とgccとclang

Last updated at Posted at 2020-07-10

概要

Arduino以外で、初めてCの勉強を始めました。
そこでコンパイルを初めて知り、調べてみたら二つの方法gccとclangがあるようだったので、違いを調べてみました。

基本の使い方

どちらもコンパイルの仕方は一緒ですね。
わたしのMacでは特に環境設定?なしでもコマンドだけ打てばコンパイルできました。

clang -o hello hello.c  #-o(名前を指定してコンパイル) 名前 ファイル
gcc -o hello hello.c

clang gccの違い

さっくり調べてみました。

結論、ほとんど一緒。w
もう一つ理解したことは、gccが古くて、clangが新しいコマンドであるということ。

それ以上は、私のみじんこコードをコンパイルする上では同等のものとして良さそうです。
厳密には違いがあるそうなので、競技で使うような場合や仕事として使う場合は、より詳しく知っておく必要がありそうですが。

参考文献

http://solid.kmckk.com/doc/skit/current/solid_toolchain/clang.html
http://c-lang.sevendays-study.com/column-19.html

0
0
2

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