1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CentOS 6.6 + Intel compiler 15 で c++11 の機能を使う

Last updated at Posted at 2015-05-15

インテルコンパイラでは -std=c++11 のオプションを用いて

icpc -std=c++11 test.cc

などとすると c++11 の機能が使えます。

しかし、icpc は gcc のライブラリを使用しており、
CentOS 6.6 ではデフォルトの gcc バージョンが 4.4.7で
あるためコンパイルが通りません。

そこで、まず devtools より gcc 4.8 をインストールします

  wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
  yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++ devtoolset-2-gcc-gfortran

(参考:http://abyssluke.hatenablog.com/entry/2014/07/07/202702)

これにより /opt/rh/devtoolset-2/root/usr/bin/ 以下に新しいバージョンの gcc が
入るので、これを用いてコンパイルします。

デフォルトの gcc と置き換えない場合は icpc のオプションに

icpc -std=c++11 -gxx-name=/opt/rh/devtoolset-2/root/usr/bin/g++ test.cc

などと書けばコンパイルが通ります。

1
2
0

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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?