Skip to content

Runtime error #1

Description

@BrinthaVP

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;
^~~~~~~~
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::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)...} {
'''

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions