Segmentation fault when using boost::numpy::ndarray

前端 未结 1 1609
温柔的废话
温柔的废话 2021-02-20 17:33

I am getting what I think is a strange seg fault when I am trying to pass boost::numpy::ndarray as an argument:

#include 
#include &         


        
1条回答
  •  心在旅途
    2021-02-20 17:59

    I knew it was something simple. I needed to add these two lines:

    Py_Initialize();
    boost::numpy::initialize();
    

    as explained : here seg fault results after any attempt to use boost::numpy::ndarray if the above lines are not ran.

    Therefore: my file becomes:

    #include 
    #include 
    #include 
    
    
    void say_hello(boost::numpy::ndarray& my_array)
    //void say_hello(int x) This works fine
    {
      std::cout<<"Hello"<

    0 讨论(0)
提交回复
热议问题