2016-06-16 10 views
-1

ランダムな整数のベクトルを作成しようとしていますが、mpic++でコンパイルしようとすると、コンパイラが#include <random> 。以下は私がコンパイルしようとしているコードです。ランダムな整数のベクトルを作成しようとすると、コンパイラのエラー

#include <stdio.h> 
#include <stdlib.h> 
#include <random> 
#include <vector> 
#include <algorithm> 
#include <map> 

using namespace std; 

int main(int argc, char **argv) 
{ 
    vector<int> vec(5); 
    random_device rd; 
    mt19937 gen(rd()); 
    uniform_int_distribution<> dis; 
    generate(vec.begin(), vec.end(), [&](){ return dis(gen); }); 

    return 0; 
} 

それはそれを使用していますが、問題は、このコードの一部である、より大きなプログラムの一部ですので、私はopenmpiを使用しています。以下は私がそれをコンパイルするために使用しているものです。以下は

mpic++ program.cpp -o program.o 

私は取得していますエラーです:

In file included from /usr/include/c++/4.8/random:35:0, 
      from program.cpp:3: 
/usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options 

gccのバージョンがgcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)です。その標準でコンパイルしようとするフラグがありますか?

答えて

1

は、コンパイラの通り行うとstdフラグを使用します。

-std=c++11 

ヘッダーrandomは本当にC++ 11の拡張機能です。この問題は、openMPIとは関係ありません。

関連する問題