- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试编译#includes 库的代码
在代码中我有以下几行:
int main()
{
clock_t begin = clock();
random_device rd;
mt19937 gen(rd());
uniform_real_distribution<> U(0,1);
default_random_engine generator;
rr1=U(gen);
}
当我使用以下行进行编译时:
icpc -std=c++0x -std=c++11 -o main main.cpp -O3
我收到以下错误:
main.cpp(152): error: identifier "uniform_real_distribution" is undefined uniform_real_distribution<> U(0,1); ^
main.cpp(152): error: expected an expression uniform_real_distribution<> U(0,1); ^
main.cpp(368): error: identifier "default_random_engine" is undefined default_random_engine generator; ^
main.cpp(441): error: identifier "U" is undefined rr1=U(gen); // first random number for time interval
main.cpp(509): warning #1595: non-POD (Plain Old Data) class type passed through ellipsis rr1=U(gen);
知道如何解决这个问题吗?
最佳答案
这个问题是因为你的Intel的编译器icpc版本没有完全支持c++11,其实就是c++0x。
这意味着:
uniform_real_distribution
。mt19937
, mt19937_64
或任何其他伪随机生成器。我猜上面的部分回答了你的问题。
想了解更多?
对于Intel的用户,可以先检查编译器的兼容性,将icc的版本号翻译成相对相同的gcc的版本号,然后从c++0x/c++11 supported list中查看。
对于 GNU 用户,您可以直接从 c++0x/c++11 supported list 检查编译器的兼容性。
例如,您可以
你可能会得到类似的东西
$icpc -v
这意味着您的 Inter 编译器的版本是 a.b.c 并且它的兼容性是 gcc 版本 x.y.z。
icpc 版本 a.b.c(gcc 版本 x.y.z 兼容性)
并且由于 uniform_real_distribution
在 GCC 4.4.5 之前不 受支持? (GCC 4.4.7 已验证支持)
那么如果你的 x.y.z 晚于 4.4.5?(肯定是 4.4.7)你可以使用 'uniform_xxx_distribution' 函数系列而不会出现兼容性问题。
关于c++ - 使用 icpc 编译 - 使用库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38951081/
我正在尝试编译以下代码: #include int main() { std::map test; return 0; } 使用以下命令: icpc -I /usr/include/x86_
我正在尝试用 C++ 编译一段代码,它使用了过度对齐的变量。如果我尝试编译以下代码(MWE) #include #include int main() { alignas(32) doub
我在练ACM ICPC 历代题http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_proble
昨天我们在PC上进行了练习^2,它是比赛的官方裁判软件,但我遇到了问题,我的问题代码是正确的,答案也是正确的,但当我将其发送到软件时它回答我“运行时错误”。 我认为我的问题在输入文件中,他们想要来自输
一个相当基本的问题,但我在这里有点迷路。我正在开发一个处理复数的库。到目前为止,我在 Mac OS 10.8 和 Ubuntu 10.04 下使用了我的实现(通过在 Man 上使用 llvm-gcc,
我正在尝试编译#includes 库的代码 在代码中我有以下几行: int main() { clock_t begin = clock(); random_device rd;
我有以下测试代码: // friendfunction.h
我在 Linux 上安装了英特尔编译器 composer_xe_2013_sp1.3.174。我对 icc 警告感到困惑。用一个简单的程序 main.c 喂 icc,如下所示: int main(in
我在以下 $HOME/tpl/intel 安装了 intel 编译器。当我编译启用了 openMP 的简单 hello_omp.cpp #include #include int main ()
我在我的大学领导一小群开发人员,我想解决前几年的几个 ICPC 问题集。 在 Google 上搜索不会产生有用的结果,只会出现一页页的损坏链接和私有(private) .edu 域。 有谁知道在哪里可
我正在尝试使用具有 c++11 功能的 icpc,但是我需要一个 c++11 stdlib,intel 没有提供。 我在 RHEL 6 上以用户身份运行,因此系统 libstdc++ 已过时。安装了较
有许多在线判断网站可以通过将其输出与正确答案进行比较来验证您的程序。此外,他们还会检查运行时间和内存使用情况,以确保您的程序没有超过最大限制。 那么问题来了,有些在线评委网站同时运行多个测试程序,他们
出于好奇,我查看了 2009 年 ACM 国际大学生程序设计竞赛的问题集。这些问题很有趣。它们可在 http://cm.baylor.edu/resources/pdf/2009Problems.pd
我已经坐了将近一个星期了。 Here是 PDF 格式的问题。 到目前为止我只能想到一个想法,但它失败了。这个想法是递归地创建所有在 O(num_of_connected_subgraphs) 中工作的
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
我使用的是 Ubuntu 14.04 & eclipse & intel 编译器 v 15 我有 2 个相同的程序(使用 cilk 命令)(一个作为 c 程序,另一个作为 cpp 程序)。 我可以用
玩具代码非常简单: #include #include #define A 10 #define SIZE (int)(ceil(A / 2)) // needs computation but
这个问题是 ACM ICPC 坎普尔地区淘汰赛中提出的问题的子问题: 给定由二维点界定的 2 条线段 (Pa, Pb)和 (Pc, Pd)分别找到p和 q (在 [0,1] 范围内)最小化函数 f(p
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 2 年前。 Improve this qu
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 2 年前。 Improve this qu
我是一名优秀的程序员,十分优秀!