jeudi 4 juin 2015

I'm trying to compile some code utilizing C++11's library on a linux server. The code compiles fine on my mac with this line in my makefile:

 CC = clang++ -std=c++11 -stdlib=libc++

However, when I try and compile the same code on a Linux server, with gcc version 4.8.1, I get the following error:

$ /usr/local/share/gcc481/bin/g++ -std=c++11 server.cpp
In file included from /auto/pkg/gcc-4.8.1/share/gcc481/include/c++/4.8.1/random:50:0,
                 from ellipse-graph.h:6,
                 from server.cpp:1:
/auto/pkg/gcc-4.8.1/share/gcc481/include/c++/4.8.1/bits/random.h: In instantiation of 'class std::uniform_int_distribution<double>':
server.cpp:17:59:   required from here
/auto/pkg/gcc-4.8.1/share/gcc481/include/c++/4.8.1/bits/random.h:1668:7: error: static assertion failed: template argument not an integral type
       static_assert(std::is_integral<_IntType>::value,
       ^
In file included from /auto/pkg/gcc-4.8.1/share/gcc481/include/c++/4.8.1/bits/move.h:57:0,
                 from /auto/pkg/gcc-4.8.1/share/gcc481/include/c++/4.8.1/bits/stl_pair.h:59,
                 from /auto/pkg/gcc-4.8.1/share/gcc481/include/c++/4.8.1/bits/stl_algobase.h:64,
                 from /auto/pkg/gcc-4.8.1/share/gcc481/include/c++/4.8.1/vector:60,
                 from interval.h:4,
                 from vertex.h:4,
                 from ellipse-graph.h:4,
                 from server.cpp:1:
/auto/pkg/gcc-4.8.1/share/gcc481/include/c++/4.8.1/type_traits: In instantiation of 'struct std::make_unsigned<double>':
/auto/pkg/gcc-4.8.1/share/gcc481/include/c++/4.8.1/bits/random.tcc:884:57:   required from 'std::uniform_int_distribution<_IntType>::result_type std::uniform_int_distribution<_IntType>::operator()(_UniformRandomNumberGenerator&, const std::uniform_int_distribution<_IntType>::param_type&) [with _UniformRandomNumberGenerator = std::linear_congruential_engine<long unsigned int, 16807ul, 0ul, 2147483647ul>; _IntType = double; std::uniform_int_distribution<_IntType>::result_type = double]'
/auto/pkg/gcc-4.8.1/share/gcc481/include/c++/4.8.1/bits/random.h:1770:51:   required from 'std::uniform_int_distribution<_IntType>::result_type std::uniform_int_distribution<_IntType>::operator()(_UniformRandomNumberGenerator&) [with _UniformRandomNumberGenerator = std::linear_congruential_engine<long unsigned int, 16807ul, 0ul, 2147483647ul>; _IntType = double; std::uniform_int_distribution<_IntType>::result_type = double]'
server.cpp:20:40:   required from here
/auto/pkg/gcc-4.8.1/share/gcc481/include/c++/4.8.1/type_traits:1531:62: error: invalid use of incomplete type 'class std::__make_unsigned_selector<double, false, false>'
     { typedef typename __make_unsigned_selector<_Tp>::__type type; };
                                                              ^
/auto/pkg/gcc-4.8.1/share/gcc481/include/c++/4.8.1/type_traits:1495:11: error: declaration of 'class std::__make_unsigned_selector<double, false, false>'
     class __make_unsigned_selector;
           ^

It appears the issue is the header. When I look here http://ift.tt/1JpOvKV, at "26.5", it appears that gcc 4.8.1 doesn't support random number generation, unless I'm interpreting this incorrectly. How might I compile this file?




Aucun commentaire:

Enregistrer un commentaire