尝试创建随机整数向量时的OpenMPI编译器错误
openMPI Compiler error when trying to create vector of random Integers
我正在尝试创建一个随机整数的向量,但是当我尝试使用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)
。我可以设置一个标准的标志吗?
编译器建议并使用std
标志:
-std=c++11
标题random
实际上是C 11扩展。此问题与OpenMPI无关。
相关文章:
- C/C++编译器通常会删除重复的库吗
- 模板-模板参数推导:三个不同的编译器三种不同的行为
- Win32编译器选项和内存分配
- MSVC多行宏编译器错误
- 静态数据成员的问题-修复链接错误会导致编译器错误
- C++,我收到一个无法理解的编译器错误
- 在线编译器中的分段C++没有打印消息
- 如何解决gcc编译器优化导致的centos双编译器设置中的分段错误
- C/C++预处理器是否可以检测一些编译器选项
- 是否有C++编译器选项允许激进地删除所有函数调用,并将参数传递给具有空体的函数
- C++错误C2600:无法定义编译器生成的特殊成员函数(必须首先在类中声明)
- 我需要知道编译器如何在cpp中使用析构函数
- 编译器如何区分std::vector的构造函数
- CLANG 编译器 说:变量"PTR"可能未初始化
- 告诉c++编译器该参数没有别名
- 使用仅使用一次的变量调用的复制构造函数.这可能是通过调用move构造函数进行编译器优化的情况吗
- 如何要求 macports 用英特尔编译器包装 openmpi?
- openmpi 编译器有什么区别
- 尝试创建随机整数向量时的OpenMPI编译器错误
- 使用英特尔编译器套件编译 OpenMPI 应用