Skip to content

Instantly share code, notes, and snippets.

@atifkarim
Last active February 21, 2021 11:47
Show Gist options
  • Save atifkarim/5ac63ac5ea918c9ab1ac09588aa01fe4 to your computer and use it in GitHub Desktop.
Save atifkarim/5ac63ac5ea918c9ab1ac09588aa01fe4 to your computer and use it in GitHub Desktop.
error text of pybind while binding class template consistig virtual function
[ 11%] Building CXX object CMakeFiles/somecode.dir/src/binding.cpp.o
In file included from /media/atif/BE0E05910E0543BD/University of Bremen MSc/my_git_repos/pybind_cpp_cmake/lib/pybind11/include/pybind11/pybind11.h:48:0,
from /media/atif/BE0E05910E0543BD/University of Bremen MSc/my_git_repos/pybind_cpp_cmake/src/binding.cpp:1:
/media/atif/BE0E05910E0543BD/University of Bremen MSc/my_git_repos/pybind_cpp_cmake/lib/pybind11/include/pybind11/detail/init.h: In instantiation of ‘Class* pybind11::detail::initimpl::construct_or_initialize(Args&& ...) [with Class = declare_class_template_abstarct(pybind11::module&, const string&) [with T = int; pybind11::module = pybind11::module_; std::__cxx11::string = std::__cxx11::basic_string<char>]::PyVirtualClass; Args = {int}; typename std::enable_if<(! std::is_constructible<_Tp, _Args>::value), int>::type <anonymous> = 0]’:
/media/atif/BE0E05910E0543BD/University of Bremen MSc/my_git_repos/pybind_cpp_cmake/lib/pybind11/include/pybind11/detail/init.h:196:68: required from ‘pybind11::detail::initimpl::constructor<Args>::execute(Class&, const Extra& ...)::<lambda(pybind11::detail::value_and_holder&, Args ...)> [with Class = pybind11::class_<Base_Abstract<int>, declare_class_template_abstarct(pybind11::module&, const string&) [with T = int; pybind11::module = pybind11::module_; std::__cxx11::string = std::__cxx11::basic_string<char>]::PyVirtualClass>; Extra = {}; typename std::enable_if<(Class:: has_alias && (! std::is_constructible<typename Class::type, Args ...>::value)), int>::type <anonymous> = 0; Args = {int}]’
/media/atif/BE0E05910E0543BD/University of Bremen MSc/my_git_repos/pybind_cpp_cmake/lib/pybind11/include/pybind11/detail/init.h:195:29: required from ‘struct pybind11::detail::initimpl::constructor<Args>::execute(Class&, const Extra& ...) [with Class = pybind11::class_<Base_Abstract<int>, declare_class_template_abstarct(pybind11::module&, const string&) [with T = int; pybind11::module = pybind11::module_; std::__cxx11::string = std::__cxx11::basic_string<char>]::PyVirtualClass>; Extra = {}; typename std::enable_if<(Class:: has_alias && (! std::is_constructible<typename Class::type, Args ...>::value)), int>::type <anonymous> = 0; Args = {int}]::<lambda(struct pybind11::detail::value_and_holder&, int)>’
/media/atif/BE0E05910E0543BD/University of Bremen MSc/my_git_repos/pybind_cpp_cmake/lib/pybind11/include/pybind11/detail/init.h:195:9: required from ‘static void pybind11::detail::initimpl::constructor<Args>::execute(Class&, const Extra& ...) [with Class = pybind11::class_<Base_Abstract<int>, declare_class_template_abstarct(pybind11::module&, const string&) [with T = int; pybind11::module = pybind11::module_; std::__cxx11::string = std::__cxx11::basic_string<char>]::PyVirtualClass>; Extra = {}; typename std::enable_if<(Class:: has_alias && (! std::is_constructible<typename Class::type, Args ...>::value)), int>::type <anonymous> = 0; Args = {int}]’
/media/atif/BE0E05910E0543BD/University of Bremen MSc/my_git_repos/pybind_cpp_cmake/lib/pybind11/include/pybind11/pybind11.h:1296:9: required from ‘pybind11::class_<type_, options>& pybind11::class_<type_, options>::def(const pybind11::detail::initimpl::constructor<Args ...>&, const Extra& ...) [with Args = {int}; Extra = {}; type_ = Base_Abstract<int>; options = {declare_class_template_abstarct(pybind11::module&, const string&) [with T = int; pybind11::module = pybind11::module_; std::__cxx11::string = std::__cxx11::basic_string<char>]::PyVirtualClass}]’
/media/atif/BE0E05910E0543BD/University of Bremen MSc/my_git_repos/pybind_cpp_cmake/src/binding.cpp:92:10: required from ‘void declare_class_template_abstarct(pybind11::module&, const string&) [with T = int; pybind11::module = pybind11::module_; std::__cxx11::string = std::__cxx11::basic_string<char>]’
/media/atif/BE0E05910E0543BD/University of Bremen MSc/my_git_repos/pybind_cpp_cmake/src/binding.cpp:130:50: required from here
/media/atif/BE0E05910E0543BD/University of Bremen MSc/my_git_repos/pybind_cpp_cmake/lib/pybind11/include/pybind11/detail/init.h:63:64: error: no matching function for call to ‘declare_class_template_abstarct(pybind11::module&, const string&) [with T = int; pybind11::module = pybind11::module_; std::__cxx11::string = std::__cxx11::basic_string<char>]::PyVirtualClass::PyVirtualClass(<brace-enclosed initializer list>)’
inline Class *construct_or_initialize(Args &&...args) { return new Class{std::forward<Args>(args)...}; }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/media/atif/BE0E05910E0543BD/University of Bremen MSc/my_git_repos/pybind_cpp_cmake/src/binding.cpp:74:11: note: candidate: constexpr declare_class_template_abstarct(pybind11::module&, const string&) [with T = int; pybind11::module = pybind11::module_; std::__cxx11::string = std::__cxx11::basic_string<char>]::PyVirtualClass::PyVirtualClass(const declare_class_template_abstarct(pybind11::module&, const string&) [with T = int; pybind11::module = pybind11::module_; std::__cxx11::string = std::__cxx11::basic_string<char>]::PyVirtualClass&)
class PyVirtualClass : public Base_Abstract<T>{
^~~~~~~~~~~~~~
/media/atif/BE0E05910E0543BD/University of Bremen MSc/my_git_repos/pybind_cpp_cmake/src/binding.cpp:74:11: note: no known conversion for argument 1 from ‘int’ to ‘const declare_class_template_abstarct(pybind11::module&, const string&) [with T = int; pybind11::module = pybind11::module_; std::__cxx11::string = std::__cxx11::basic_string<char>]::PyVirtualClass&’
/media/atif/BE0E05910E0543BD/University of Bremen MSc/my_git_repos/pybind_cpp_cmake/src/binding.cpp:74:11: note: candidate: constexpr declare_class_template_abstarct(pybind11::module&, const string&) [with T = int; pybind11::module = pybind11::module_; std::__cxx11::string = std::__cxx11::basic_string<char>]::PyVirtualClass::PyVirtualClass(declare_class_template_abstarct(pybind11::module&, const string&) [with T = int; pybind11::module = pybind11::module_; std::__cxx11::string = std::__cxx11::basic_string<char>]::PyVirtualClass&&)
/media/atif/BE0E05910E0543BD/University of Bremen MSc/my_git_repos/pybind_cpp_cmake/src/binding.cpp:74:11: note: no known conversion for argument 1 from ‘int’ to ‘declare_class_template_abstarct(pybind11::module&, const string&) [with T = int; pybind11::module = pybind11::module_; std::__cxx11::string = std::__cxx11::basic_string<char>]::PyVirtualClass&&’
CMakeFiles/somecode.dir/build.make:172: recipe for target 'CMakeFiles/somecode.dir/src/binding.cpp.o' failed
make[2]: *** [CMakeFiles/somecode.dir/src/binding.cpp.o] Error 1
CMakeFiles/Makefile2:114: recipe for target 'CMakeFiles/somecode.dir/all' failed
make[1]: *** [CMakeFiles/somecode.dir/all] Error 2
Makefile:102: recipe for target 'all' failed
make: *** [all] Error 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment