「g++をUbuntuへインストールする」の版間の差分
提供: C++入門
| (同じ利用者による、間の1版が非表示) | |||
| 行4: | 行4: | ||
== 概要 == | == 概要 == | ||
| − | + | [[g++]]は、GNU GCCの[[C++コンパイラ]]です。 | |
== インストール == | == インストール == | ||
| − | {{apt| | + | {{apt|g++}} |
| + | == g++4.9をインストール == | ||
| + | <syntaxhighlight lang="bash"> | ||
| + | sudo apt install g++-4.9 | ||
| + | </syntaxhighlight> | ||
| + | == g++4.8をインストール == | ||
| + | <syntaxhighlight lang="bash"> | ||
| + | sudo apt install g++-4.8 | ||
| + | </syntaxhighlight> | ||
| + | == g++4.7をインストール == | ||
| + | <syntaxhighlight lang="bash"> | ||
| + | sudo apt install g++-4.7 | ||
| + | </syntaxhighlight> | ||
| + | == g++4.6をインストール == | ||
| + | <syntaxhighlight lang="bash"> | ||
| + | sudo apt install g++-4.6 | ||
| + | </syntaxhighlight> | ||
| + | == g++4.5をインストール == | ||
| + | <syntaxhighlight lang="bash"> | ||
| + | sudo apt install g++-4.5 | ||
| + | </syntaxhighlight> | ||
| + | == g++4.4をインストール == | ||
| + | <syntaxhighlight lang="bash"> | ||
| + | sudo apt install g++-4.4 | ||
| + | </syntaxhighlight> | ||
| + | == g++パッケージを検索する == | ||
| + | apt-cacheでg++のパッケージを検索できます。 | ||
| + | <syntaxhighlight lang="bash"> | ||
| + | $ apt-cache search 'g++'|grep ^g++ | ||
| + | </syntaxhighlight> | ||
| + | aptコマンドの場合は、以下の通りです。 | ||
| + | <syntaxhighlight lang="bash"> | ||
| + | $ apt search 'g++' |grep ^g++ | ||
| + | |||
| + | WARNING: apt does not have a stable CLI interface yet. Use with caution in scripts. | ||
| + | |||
| + | g++/utopic,now 4:4.9.1-4ubuntu2 amd64 [installed,automatic] | ||
| + | g++-4.4/utopic 4.4.7-8ubuntu1 amd64 | ||
| + | g++-4.4-multilib/utopic 4.4.7-8ubuntu1 amd64 | ||
| + | g++-4.6/utopic 4.6.4-6ubuntu2 amd64 | ||
| + | g++-4.6-multilib/utopic 4.6.4-6ubuntu2 amd64 | ||
| + | g++-4.7/utopic 4.7.4-2ubuntu1 amd64 | ||
| + | g++-4.7-arm-linux-gnueabi/utopic 4.7.4-2ubuntu1cross1.86 amd64 | ||
| + | g++-4.7-arm-linux-gnueabihf/utopic 4.7.4-2ubuntu1cross1.86 amd64 | ||
| + | g++-4.7-multilib/utopic 4.7.4-2ubuntu1 amd64 | ||
| + | g++-4.7-multilib-arm-linux-gnueabi/utopic 4.7.4-2ubuntu1cross1.86 amd64 | ||
| + | g++-4.7-multilib-arm-linux-gnueabihf/utopic 4.7.4-2ubuntu1cross1.86 amd64 | ||
| + | g++-4.8/utopic 4.8.3-12ubuntu3 amd64 | ||
| + | g++-4.8-aarch64-linux-gnu/utopic 4.8.3-12ubuntu3cross0.12 amd64 | ||
| + | g++-4.8-arm-linux-gnueabihf/utopic 4.8.3-12ubuntu3cross0.13 amd64 | ||
| + | g++-4.8-multilib/utopic 4.8.3-12ubuntu3 amd64 | ||
| + | g++-4.8-multilib-arm-linux-gnueabihf/utopic 4.8.3-12ubuntu3cross0.13 amd64 | ||
| + | g++-4.8-multilib-powerpc-linux-gnu/utopic 4.8.3-12ubuntu3cross0.14 amd64 | ||
| + | g++-4.8-powerpc-linux-gnu/utopic 4.8.3-12ubuntu3cross0.14 amd64 | ||
| + | g++-4.8-powerpc64le-linux-gnu/utopic 4.8.3-12ubuntu3cross0.5 amd64 | ||
| + | g++-4.9/utopic,now 4.9.1-16ubuntu6 amd64 [installed,automatic] | ||
| + | g++-4.9-aarch64-linux-gnu/utopic 4.9.1-16ubuntu6cross0.4 amd64 | ||
| + | g++-4.9-arm-linux-gnueabihf/utopic 4.9.1-16ubuntu6cross0.4 amd64 | ||
| + | g++-4.9-multilib/utopic 4.9.1-16ubuntu6 amd64 | ||
| + | g++-4.9-multilib-arm-linux-gnueabihf/utopic 4.9.1-16ubuntu6cross0.4 amd64 | ||
| + | g++-4.9-multilib-powerpc-linux-gnu/utopic 4.9.1-16ubuntu6cross0.4 amd64 | ||
| + | g++-4.9-powerpc-linux-gnu/utopic 4.9.1-16ubuntu6cross0.4 amd64 | ||
| + | g++-4.9-powerpc64le-linux-gnu/utopic 4.9.1-16ubuntu6cross0.3 amd64 | ||
| + | g++-aarch64-linux-gnu/utopic 4:4.9.1-1 amd64 | ||
| + | g++-arm-linux-gnueabi/utopic 4:4.7.2-1 amd64 | ||
| + | g++-arm-linux-gnueabihf/utopic 4:4.9.1-1 amd64 | ||
| + | g++-mingw-w64/utopic 4.9.1-4ubuntu3+14.1 all | ||
| + | g++-mingw-w64-i686/utopic 4.9.1-4ubuntu3+14.1 amd64 | ||
| + | g++-mingw-w64-x86-64/utopic 4.9.1-4ubuntu3+14.1 amd64 | ||
| + | g++-multilib/utopic 4:4.9.1-4ubuntu2 amd64 | ||
| + | g++-powerpc-linux-gnu/utopic 4:4.9.1-1 amd64 | ||
| + | g++-powerpc64le-linux-gnu/utopic 4:4.9.1-1 amd64 | ||
| + | </syntaxhighlight> | ||
| + | == バージョン == | ||
| + | <syntaxhighlight lang="bash"> | ||
| + | $ lsb_release -a | ||
| + | No LSB modules are available. | ||
| + | Distributor ID: Ubuntu | ||
| + | Description: Ubuntu 14.10 | ||
| + | Release: 14.10 | ||
| + | Codename: utopic | ||
| + | $ g++ --version | ||
| + | g++ (Ubuntu 4.9.1-16ubuntu6) 4.9.1 | ||
| + | Copyright (C) 2014 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> | ||
| + | <syntaxhighlight lang="bash"> | ||
| + | $ g++ --version | ||
| + | g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 | ||
| + | Copyright (C) 2011 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> | ||
| + | == ヘッダファイル == | ||
| + | g++ 4.6 の場合、ヘッダファイルは、 /usr/include/c++/4.6 に入ります。 | ||
| + | <syntaxhighlight lang="bash"> | ||
| + | $ ls /usr/include/c++/4.6 | ||
| + | algorithm future | ||
| + | array i686-linux-gnu/ | ||
| + | atomic initializer_list | ||
| + | backward/ iomanip | ||
| + | bits/ ios | ||
| + | bitset iosfwd | ||
| + | cassert iostream | ||
| + | ccomplex istream | ||
| + | cctype iterator | ||
| + | cerrno limits | ||
| + | cfenv list | ||
| + | cfloat locale | ||
| + | chrono map | ||
| + | cinttypes memory | ||
| + | ciso646 mutex | ||
| + | climits new | ||
| + | clocale numeric | ||
| + | cmath ostream | ||
| + | complex parallel/ | ||
| + | complex.h profile/ | ||
| + | condition_variable queue | ||
| + | csetjmp random | ||
| + | csignal ratio | ||
| + | cstdarg regex | ||
| + | cstdbool set | ||
| + | cstddef sstream | ||
| + | cstdint stack | ||
| + | cstdio stdexcept | ||
| + | cstdlib streambuf | ||
| + | cstring string | ||
| + | ctgmath system_error | ||
| + | ctime tgmath.h | ||
| + | cwchar thread | ||
| + | cwctype tr1/ | ||
| + | cxxabi.h tuple | ||
| + | debug/ type_traits | ||
| + | decimal/ typeindex | ||
| + | deque typeinfo | ||
| + | exception unordered_map | ||
| + | ext/ unordered_set | ||
| + | fenv.h utility | ||
| + | forward_list valarray | ||
| + | fstream vector | ||
| + | functional | ||
| + | </syntaxhighlight> | ||
== 関連項目 == | == 関連項目 == | ||
{{g++}} | {{g++}} | ||
<!-- vim: filetype=mediawiki | <!-- vim: filetype=mediawiki | ||
--> | --> | ||
2015年4月30日 (木) 23:12時点における最新版
GNU GCCコンパイラコレクションC++コンパイラであるg++をUbuntuにインストールする方法です。
目次
概要
インストール
Ubuntu/Debianにインストールする場合
apt コマンドでインストールする場合です。
sudo apt install g++
g++4.9をインストール
sudo apt install g++-4.9
g++4.8をインストール
sudo apt install g++-4.8
g++4.7をインストール
sudo apt install g++-4.7
g++4.6をインストール
sudo apt install g++-4.6
g++4.5をインストール
sudo apt install g++-4.5
g++4.4をインストール
sudo apt install g++-4.4
g++パッケージを検索する
apt-cacheでg++のパッケージを検索できます。
$ apt-cache search 'g++'|grep ^g++
aptコマンドの場合は、以下の通りです。
$ apt search 'g++' |grep ^g++ WARNING: apt does not have a stable CLI interface yet. Use with caution in scripts. g++/utopic,now 4:4.9.1-4ubuntu2 amd64 [installed,automatic] g++-4.4/utopic 4.4.7-8ubuntu1 amd64 g++-4.4-multilib/utopic 4.4.7-8ubuntu1 amd64 g++-4.6/utopic 4.6.4-6ubuntu2 amd64 g++-4.6-multilib/utopic 4.6.4-6ubuntu2 amd64 g++-4.7/utopic 4.7.4-2ubuntu1 amd64 g++-4.7-arm-linux-gnueabi/utopic 4.7.4-2ubuntu1cross1.86 amd64 g++-4.7-arm-linux-gnueabihf/utopic 4.7.4-2ubuntu1cross1.86 amd64 g++-4.7-multilib/utopic 4.7.4-2ubuntu1 amd64 g++-4.7-multilib-arm-linux-gnueabi/utopic 4.7.4-2ubuntu1cross1.86 amd64 g++-4.7-multilib-arm-linux-gnueabihf/utopic 4.7.4-2ubuntu1cross1.86 amd64 g++-4.8/utopic 4.8.3-12ubuntu3 amd64 g++-4.8-aarch64-linux-gnu/utopic 4.8.3-12ubuntu3cross0.12 amd64 g++-4.8-arm-linux-gnueabihf/utopic 4.8.3-12ubuntu3cross0.13 amd64 g++-4.8-multilib/utopic 4.8.3-12ubuntu3 amd64 g++-4.8-multilib-arm-linux-gnueabihf/utopic 4.8.3-12ubuntu3cross0.13 amd64 g++-4.8-multilib-powerpc-linux-gnu/utopic 4.8.3-12ubuntu3cross0.14 amd64 g++-4.8-powerpc-linux-gnu/utopic 4.8.3-12ubuntu3cross0.14 amd64 g++-4.8-powerpc64le-linux-gnu/utopic 4.8.3-12ubuntu3cross0.5 amd64 g++-4.9/utopic,now 4.9.1-16ubuntu6 amd64 [installed,automatic] g++-4.9-aarch64-linux-gnu/utopic 4.9.1-16ubuntu6cross0.4 amd64 g++-4.9-arm-linux-gnueabihf/utopic 4.9.1-16ubuntu6cross0.4 amd64 g++-4.9-multilib/utopic 4.9.1-16ubuntu6 amd64 g++-4.9-multilib-arm-linux-gnueabihf/utopic 4.9.1-16ubuntu6cross0.4 amd64 g++-4.9-multilib-powerpc-linux-gnu/utopic 4.9.1-16ubuntu6cross0.4 amd64 g++-4.9-powerpc-linux-gnu/utopic 4.9.1-16ubuntu6cross0.4 amd64 g++-4.9-powerpc64le-linux-gnu/utopic 4.9.1-16ubuntu6cross0.3 amd64 g++-aarch64-linux-gnu/utopic 4:4.9.1-1 amd64 g++-arm-linux-gnueabi/utopic 4:4.7.2-1 amd64 g++-arm-linux-gnueabihf/utopic 4:4.9.1-1 amd64 g++-mingw-w64/utopic 4.9.1-4ubuntu3+14.1 all g++-mingw-w64-i686/utopic 4.9.1-4ubuntu3+14.1 amd64 g++-mingw-w64-x86-64/utopic 4.9.1-4ubuntu3+14.1 amd64 g++-multilib/utopic 4:4.9.1-4ubuntu2 amd64 g++-powerpc-linux-gnu/utopic 4:4.9.1-1 amd64 g++-powerpc64le-linux-gnu/utopic 4:4.9.1-1 amd64
バージョン
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.10 Release: 14.10 Codename: utopic $ g++ --version g++ (Ubuntu 4.9.1-16ubuntu6) 4.9.1 Copyright (C) 2014 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.
$ g++ --version g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 Copyright (C) 2011 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.
ヘッダファイル
g++ 4.6 の場合、ヘッダファイルは、 /usr/include/c++/4.6 に入ります。
$ ls /usr/include/c++/4.6 algorithm future array i686-linux-gnu/ atomic initializer_list backward/ iomanip bits/ ios bitset iosfwd cassert iostream ccomplex istream cctype iterator cerrno limits cfenv list cfloat locale chrono map cinttypes memory ciso646 mutex climits new clocale numeric cmath ostream complex parallel/ complex.h profile/ condition_variable queue csetjmp random csignal ratio cstdarg regex cstdbool set cstddef sstream cstdint stack cstdio stdexcept cstdlib streambuf cstring string ctgmath system_error ctime tgmath.h cwchar thread cwctype tr1/ cxxabi.h tuple debug/ type_traits decimal/ typeindex deque typeinfo exception unordered_map ext/ unordered_set fenv.h utility forward_list valarray fstream vector functional