Debian 系統(如 Ubuntu 等)
sudo apt−get install build−essential
支持 RPM 的系統(如 Fedora、Redhat 和 CentOS 等)
sudo yum groupinstall development−tools
Mac OS X
通過 App Store 安裝 Xcode 即可。
Windows
建議使用 VirtualBox 安裝 Linux,如 Ubuntu 和 CentOS。
其他選項:Cygwin 或者 MinGW,比較複雜。
檢驗
- 打開終端(Terminal)
- 執行
cc --version
- 看結果
- CentOS 7
$ cc --version cc (Ubuntu 4.8.2-19ubuntu1) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- CentOS 7
$ cc --version cc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- Mac OS X
$ cc --version Apple LLVM version 10.0.0 (clang-1000.11.45.5) Target: x86_64-apple-darwin18.2.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
- CentOS 7
From 《Learn C the Hard Way》Exercise 0