「gcc」の版間の差分
提供: C言語入門
行29: | 行29: | ||
* https://sourceware.org/cygwin/ | * https://sourceware.org/cygwin/ | ||
* http://www.mingw.org/ | * http://www.mingw.org/ | ||
+ | * http://mingw-w64.sourceforge.net/ | ||
+ | ** Windows 64bit用のMinGW/GCCが提供されます。 | ||
+ | |||
+ | MinGW では、gcc 4.8.1 が使用できます。 | ||
+ | |||
+ | C:\Program Files\mingw-builds\x64-4.8.1-posix-seh-rev5\mingw64\bin\gcc.exe | ||
+ | |||
+ | にインスールされています。 | ||
+ | |||
+ | C:\Program Files\mingw-builds\x64-4.8.1-posix-seh-rev5\mingwbuilds.bat | ||
+ | |||
+ | を起動するとパスが通った状態で、コマンドプロントが利用できます。 | ||
+ | |||
+ | <syntaxhighlight lang="dos"> | ||
+ | C:\Program Files\mingw-builds\x64-4.8.1-posix-seh-rev5\mingw64\bin>gcc -v | ||
+ | Using built-in specs. | ||
+ | COLLECT_GCC=gcc | ||
+ | COLLECT_LTO_WRAPPER=c:/program\ files/mingw-builds/x64-4.8.1-posix-seh-rev5/ming | ||
+ | w64/bin/../libexec/gcc/x86_64-w64-mingw32/4.8.1/lto-wrapper.exe | ||
+ | Target: x86_64-w64-mingw32 | ||
+ | Configured with: ../../../src/gcc-4.8.1/configure --host=x86_64-w64-mingw32 --bu | ||
+ | ild=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysr | ||
+ | oot=/tmp/x64-481-posix-seh-r5/mingw64 --enable-shared --enable-static --disable- | ||
+ | multilib --enable-languages=ada,c,c++,fortran,objc,obj-c++,lto --enable-libstdcx | ||
+ | x-time=yes --enable-threads=posix --enable-libgomp --enable-lto --enable-graphit | ||
+ | e --enable-checking=release --enable-fully-dynamic-string --enable-version-speci | ||
+ | fic-runtime-libs --disable-isl-version-check --disable-cloog-version-check --dis | ||
+ | able-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath | ||
+ | --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with | ||
+ | -gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --wit | ||
+ | h-system-zlib --with-gmp=/tmp/mingw-prereq/x86_64-w64-mingw32-static --with-mpfr | ||
+ | =/tmp/mingw-prereq/x86_64-w64-mingw32-static --with-mpc=/tmp/mingw-prereq/x86_64 | ||
+ | -w64-mingw32-static --with-isl=/tmp/mingw-prereq/x86_64-w64-mingw32-static --wit | ||
+ | h-cloog=/tmp/mingw-prereq/x86_64-w64-mingw32-static --enable-cloog-backend=isl - | ||
+ | -with-pkgversion='rev5, Built by MinGW-W64 project' --with-bugurl=http://sourcef | ||
+ | orge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -I/tmp/x64-481-posix-seh-r5/libs/i | ||
+ | nclude -I/tmp/mingw-prereq/x64-zlib/include -I/tmp/mingw-prereq/x86_64-w64-mingw | ||
+ | 32-static/include' CXXFLAGS='-O2 -pipe -I/tmp/x64-481-posix-seh-r5/libs/include | ||
+ | -I/tmp/mingw-prereq/x64-zlib/include -I/tmp/mingw-prereq/x86_64-w64-mingw32-stat | ||
+ | ic/include' CPPFLAGS= LDFLAGS='-pipe -L/tmp/x64-481-posix-seh-r5/libs/lib -L/tmp | ||
+ | /mingw-prereq/x64-zlib/lib -L/tmp/mingw-prereq/x86_64-w64-mingw32-static/lib -L/ | ||
+ | tmp/x64-481-posix-seh-r5/mingw64/opt/lib ' | ||
+ | Thread model: posix | ||
+ | gcc version 4.8.1 (rev5, Built by MinGW-W64 project) | ||
+ | |||
+ | C:\Program Files\mingw-builds\x64-4.8.1-posix-seh-rev5\mingw64\bin>g++ --version | ||
+ | |||
+ | g++ (rev5, Built by MinGW-W64 project) 4.8.1 | ||
+ | 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. | ||
+ | </syntaxhighlight> | ||
== 実行例 == | == 実行例 == | ||
=== FreeBSDの場合 === | === FreeBSDの場合 === |
2014年5月10日 (土) 21:55時点における版
gcc とは、GNUのC/C++コンパイラのパッケージ、もしくは、Cコンパイラのコマンドです。
読み方
- gcc
- じーしーしー
目次
概要
gccは、Cコンパイラのコマンド、もしくは、GNU Cコンパイラのパッケージです。
インストール
FreeBSDの場合
gcc 4.9
$ sudo pkg install gcc49
gcc 4.8
$ sudo pkg install gcc48
gcc 4.7
$ sudo pkg install gcc47
gcc 4.6
$ sudo pkg install gcc46
Windows環境
CygwinやMinGWでgccが提供されます。
- https://sourceware.org/cygwin/
- http://www.mingw.org/
- http://mingw-w64.sourceforge.net/
- Windows 64bit用のMinGW/GCCが提供されます。
MinGW では、gcc 4.8.1 が使用できます。
C:\Program Files\mingw-builds\x64-4.8.1-posix-seh-rev5\mingw64\bin\gcc.exe
にインスールされています。
C:\Program Files\mingw-builds\x64-4.8.1-posix-seh-rev5\mingwbuilds.bat
を起動するとパスが通った状態で、コマンドプロントが利用できます。
C:\Program Files\mingw-builds\x64-4.8.1-posix-seh-rev5\mingw64\bin>gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=c:/program\ files/mingw-builds/x64-4.8.1-posix-seh-rev5/ming w64/bin/../libexec/gcc/x86_64-w64-mingw32/4.8.1/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../../../src/gcc-4.8.1/configure --host=x86_64-w64-mingw32 --bu ild=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysr oot=/tmp/x64-481-posix-seh-r5/mingw64 --enable-shared --enable-static --disable- multilib --enable-languages=ada,c,c++,fortran,objc,obj-c++,lto --enable-libstdcx x-time=yes --enable-threads=posix --enable-libgomp --enable-lto --enable-graphit e --enable-checking=release --enable-fully-dynamic-string --enable-version-speci fic-runtime-libs --disable-isl-version-check --disable-cloog-version-check --dis able-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with -gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --wit h-system-zlib --with-gmp=/tmp/mingw-prereq/x86_64-w64-mingw32-static --with-mpfr =/tmp/mingw-prereq/x86_64-w64-mingw32-static --with-mpc=/tmp/mingw-prereq/x86_64 -w64-mingw32-static --with-isl=/tmp/mingw-prereq/x86_64-w64-mingw32-static --wit h-cloog=/tmp/mingw-prereq/x86_64-w64-mingw32-static --enable-cloog-backend=isl - -with-pkgversion='rev5, Built by MinGW-W64 project' --with-bugurl=http://sourcef orge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -I/tmp/x64-481-posix-seh-r5/libs/i nclude -I/tmp/mingw-prereq/x64-zlib/include -I/tmp/mingw-prereq/x86_64-w64-mingw 32-static/include' CXXFLAGS='-O2 -pipe -I/tmp/x64-481-posix-seh-r5/libs/include -I/tmp/mingw-prereq/x64-zlib/include -I/tmp/mingw-prereq/x86_64-w64-mingw32-stat ic/include' CPPFLAGS= LDFLAGS='-pipe -L/tmp/x64-481-posix-seh-r5/libs/lib -L/tmp /mingw-prereq/x64-zlib/lib -L/tmp/mingw-prereq/x86_64-w64-mingw32-static/lib -L/ tmp/x64-481-posix-seh-r5/mingw64/opt/lib ' Thread model: posix gcc version 4.8.1 (rev5, Built by MinGW-W64 project) C:\Program Files\mingw-builds\x64-4.8.1-posix-seh-rev5\mingw64\bin>g++ --version g++ (rev5, Built by MinGW-W64 project) 4.8.1 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.
実行例
FreeBSDの場合
g++49 -std=c++11 -Wl,-rpath=/usr/local/lib/gcc49/