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