Skip to content

error: no matching function for call to ‘pybind11::class_<Operations<int> > #2278

@matthrx

Description

@matthrx

Hello,

I am trying to use the pybind11 library with a very basic example. I am trying to apply pybind11 to a template class doing basic operations (for the example). I did research for a long time in order to know whether someone had faced a similar mistake but so far they are fruitless, that's why I decided to open this issue.

Here is the template class Operations (i don't include the cpp file as function are extremely simple)
subtract

And here is the file used to bind it to a python library
binding

When I attempt to install it, I have the following error :
error: no matching function for call to ‘pybind11::class_<Operations >::def(std::__cxx11::basic_string, int (Operations::*)(int, int))’
26 | .def("subtract"+type, &operations::subtract);

Thank you for your time

PS : It is the first time I open an issue, I am sincerely sorry if I was not supposed to do it for this kind of error that I think is only because I did something wrong. Obviously, I looked into the faq.html of pybind11 and found nothing relevant for my case. I didn't add the CMakeLists.txt and the setup.py, I will, if you think the error might come from them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions