64,670
社区成员
发帖
与我相关
我的任务
分享
git clone git://github.com/fengwang/random_variate_generator.git
然后cd random_variate_generator && make binomial_test
错误如下:g++ -c -O2 -Wall -g -std=c++0x -Iinclude -o ./obj/binomial_test.o example/binomial_test.cc
example/binomial_test.cc: In function ‘int main()’:
example/binomial_test.cc:13:45: error: template argument 3 is invalid
example/binomial_test.cc:13:49: error: invalid type in declaration before ‘(’ token
example/binomial_test.cc:13:58: error: initializer expression list treated as compound expression
example/binomial_test.cc:13:58: warning: left-hand operand of comma has no effect
example/binomial_test.cc:16:14: error: request for member ‘begin’ in ‘vg’, which is of non-class type ‘int’
example/binomial_test.cc:16:26: error: request for member ‘begin’ in ‘vg’, which is of non-class type ‘int’
example/binomial_test.cc:18:31: error: request for member ‘begin’ in ‘vg’, which is of non-class type ‘int’
example/binomial_test.cc:18:43: error: request for member ‘begin’ in ‘vg’, which is of non-class type ‘int’
example/binomial_test.cc:18:59: error: unable to deduce ‘auto’ from ‘<expression error>’
make: *** [binomial_test.o] Error 1
gcc 4.5.1 编译错误信息如上,icc 11.1以及ms vc10均可通过。#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <random> // for std::uniform_int_distribution
#endif
4150 typedef typename std::uniform_int_distribution<__ud_type> __distr_type;
4151 typedef typename __distr_type::param_type __p_type;
4152 __distr_type __d;
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <random> // for std::uniform_int_distribution
#endif
4150 typedef typename std::uniform_int_distribution<__ud_type> __distr_type;
4151 typedef typename __distr_type::param_type __p_type;
4152 __distr_type __d;
variate_generator<int, binomial, vg::mt19937> vg(200, 0.3);
int main()
12 12 {
13 - //variate_generator<int, binomial, mt19937> vg(200, 0.3);
14 - variate_generator<int, binomial> vg(200, 0.3);
13 + variate_generator<int, binomial, mt19937> vg(200, 0.3);
14 + //variate_generator<int, binomial> vg(200, 0.3);
15 15
16 16 copy( vg.begin(), vg.begin()+1000, ostream_iterator<int>(cout, "\n"));
……