Open BrinthaVP opened 1 year ago
On running the make command getting the following errors
In function 'SrcIter uneven_copy(SrcIter, DestIter, DestIter, std::true_type)':
user/numpy_random/src/numpy_random.h:40:47: error: 'CHAR_BIT' was not declared in this scope
constexpr uint8_t DEST_BITS = DEST_SIZE CHAR_BIT;
^~~~
user/numpy_random/src/numpy_random.h: In function 'SrcIter uneven_copy(SrcIter, DestIter, DestIter, std::false_type)':
user/numpy_random/src/numpy_random.h:63:42: error: 'CHAR_BIT' was not declared in this scope
constexpr auto SRC_BITS = SRC_SIZE CHAR_BIT;
^~~~
user/numpy_random/src/numpy_random.h: In function 'size_t uneven_copy_safe(const IdxRef&, size_t, DestIter, DestIter, std::true_type)':
user/numpy_random/src/numpy_random.h:89:47: error: 'CHAR_BIT' was not declared in this scope
constexpr uint8_t DEST_BITS = DEST_SIZE CHAR_BIT;
^~~~
user/numpy_random/src/numpy_random.h: In function 'size_t uneven_copy_safe(IdxRef&, size_t, DestIter, DestIter, std::false_type)':
user/numpy_random/src/numpy_random.h:119:44: error: 'CHAR_BIT' was not declared in this scope
constexpr size_t SRC_BITS = SRC_SIZE CHAR_BIT;
^~~~
user/numpy_random/src/numpy_random.h: At global scope:
user/numpy_random/src/numpy_random.h:165:1: error: '_INLINE_VAR' does not name a type; did you mean 'LINE'?
_INLINE_VAR constexpr bool is_static_castable_v =
^~~
LINE
user/numpy_random/src/numpy_random.h:169:48: error: 'is_static_castable_v' was not declared in this scope
struct is_static_castable : std::bool_constant<is_static_castable_v<F, T>> {};
^~~~~~~~
user/numpy_random/src/numpy_random.h:169:48: note: suggested alternative: 'is_static_castable'
struct is_static_castable : std::bool_constant<is_static_castable_v<F, T>> {};
^~~~~~~~
is_static_castable
user/numpy_random/src/numpy_random.h:169:72: error: wrong number of template arguments (2, should be 1)
struct is_static_castable : std::bool_constant<is_static_castable_v<F, T>> {};
^
anaconda3/x86_64-conda_cos6-linux-gnu/include/c++/7.3.0/type_traits:98:55: note: provided for 'template~~
LINE
user/numpy_random/src/numpy_random.h:176:1: error: '_INLINE_VAR' does not name a type; did you mean 'LINE'?
_INLINE_VAR constexpr bool is_arithmetic_castable_v =
^~~
LINE
user/numpy_random/src/numpy_random.h:242:32: error: expected nested-name-specifier
using RngReturn = typename raw_type<decltype(std::declval~~~~~~~~~~
user/numpy_random/src/numpy_random.h:243:64: error: 'RngReturn' was not declared in this scope
static constexpr bool is_arithmetic = std::is_arithmetic_v~~~~
user/numpy_random/src/numpy_random.h:244:69: error: 'RngReturn' was not declared in this scope
static constexpr bool is_container_arithmetic = valid_container~~~~
user/numpy_random/src/numpy_random.h:246:9: error: 'is_arithmetic_castable_v' was not declared in this scope
is_arithmetic_castable_v~~~~~~~
user/numpy_random/src/numpy_random.h:246:9: note: suggested alternative: 'is_static_castable'
is_arithmetic_castable_v~~~~~~~
is_static_castable
user/numpy_random/src/numpy_random.h:246:34: error: 'RngReturn' was not declared in this scope
is_arithmetic_castable_v~~~~
user/numpy_random/src/numpy_random.h:246:48: error: label 'valid_custom_arithmetic' referenced outside of any function
is_arithmetic_castable_v~~~~~~
user/numpy_random/src/numpy_random.h:246:72: error: 'RngReturn' was not declared in this scope
is_arithmetic_castable_v~~~~
user/numpy_random/src/numpy_random.h:246:83: error: expected primary-expression before ')' token
is_arithmetic_castable_v~~~~~~~
user/numpy_random/src/numpy_random.h:218:20: note: suggested alternative: 'is_static_castable'
return is_arithmetic_castable_v<raw_type~~~~~~~
is_static_castable
user/numpy_random/src/numpy_random.h:218:62: error: expected primary-expression before '>' token
return is_arithmetic_castable_v<raw_type~~
user/numpy_random/src/numpy_random.h:281:19: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
user/numpy_random/src/numpy_random.h: In member function 'int64_t RandomState~~~~~
user/numpy_random/src/numpy_random.h: In member function 'T RandomState~~~
user/numpy_random/src/numpy_random.h: In static member function 'static uint64_t RandomState~~~~
user/numpy_random/src/numpy_random.h:455:53: error: 'container' was not declared in this scope
_uintegers_cnt += copy_to_container(container, _uintegers);
^~~~~
user/numpy_random/src/numpy_random.h:458:57: error: 'RngReturn' was not declared in this scope
if constexpr (sizeof(uint64_t) < sizeof(RngReturn)) {
^~~~~
user/numpy_random/src/numpy_random.h:459:31: error: expected ';' before 'container'
RngReturn container[1]{_engine()};
^~~~~
user/numpy_random/src/numpy_random.h:460:57: error: 'container' was not declared in this scope
_uintegers_cnt += copy_to_container(container, _uintegers);
^~~~~
user/numpy_random/src/numpy_random.h: In static member function 'static T RandomState~~~~
user/numpy_random/src/numpy_random.h:485:35: error: the value of 'IS_32BIT' is not usable in a constant expression
if constexpr (IS_32BIT) {
^
user/numpy_random/src/numpy_random.h:500:35: error: the value of 'IS_32BIT' is not usable in a constant expression
if constexpr (IS_32BIT) {
^
user/numpy_random/src/numpy_random.h: In static member function 'static double RandomState~~~~
user/numpy_random/src/numpy_random.h: In constructor 'NumpySeedSequence<result_type, pool_size>::NumpySeedSequence(const std::vector~~
user/numpy_random/src/numpy_random.h:570:10: note: conversion of argument 1 would be ill-formed:
user/numpy_random/src/numpy_random.h: In member function 'void NumpySeedSequence<result_type, pool_size>::generate(DestIter, DestIter)':
user/numpy_random/src/numpy_random.h:647:18: error: 'reverse' is not a member of 'std'
std::reverse(start, finish);
^~~
make[2]: [src/CMakeFiles/numpy_random.dir/numpy_random.cpp.o] Error 1
make[1]: [src/CMakeFiles/numpy_random.dir/all] Error 2
make: *** [all] Error 2
By passing the argument -std=c++11
, you are instructing GCC to use C++ 11. However, in order to compile it, you will need to use the appropriate compiler flags or options to use C++ 17.
Hi,
I am trying to use numpy_random library for my project. But facing some issues.
First I build the code using the command cmake CmakeFiles.txt and then copied the src/numpy_random.h to the directory that contains the code in the sample in a file trial.cpp.
I ran the trial.cpp using the command g++ -L "/data/users/numpy_random" -std=c++11 trial.cpp
But I am getting errors like this:
''' trial.cpp: In function 'int main()': trial.cpp:12:23: error: 'class RandomState<std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253> >' has no member named 'rand_int' std::cout << random.rand_int(0, 9) << std::endl; ^::RandomState(Ts&& ...) [with Ts = {RandomState<std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253> >}; RngEngine = std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>]':
trial.cpp:9:41: required from here
numpy_random.h:261:66: error: cannot bind non-const lvalue reference of type 'RandomState<std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253> >&' to an rvalue of type 'RandomState<std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253> >'
RandomState(Ts&&... args) : _engine{std::forward(args)...} {
'''
~~~ trial.cpp:13:23: error: 'class RandomState<std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253> >' has no member named 'rand_int' std::cout << random.rand_int(0, 9) << std::endl; ^~~~ trial.cpp:14:23: error: 'class RandomState<std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253> >' has no member named 'rand_int' std::cout << random.rand_int(0, 9) << std::endl; ^~~~ trial.cpp:15:23: error: 'class RandomState<std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253> >' has no member named 'rand_int' std::cout << random.rand_int(0, 9) << std::endl; ^~~~ In file included from trial.cpp:3:0: numpy_random.h: In instantiation of 'RandomState