Skip to content

Using pybind with existing CMake structure #1217

@JohnV7

Description

@JohnV7

Issue description

I'm trying to use pybind with an existinc cmake structure. I modified the existing CMakeLists.txt file adding
add_subdirectory(src/pybind11)
pybind11_add_module(mycode src/mycode.cpp)
target_link_libraries(mycode PRIVATE ${MYCODE_LIBRARIES})

This compiles succesfully and generates mycode.so, but when trying to import it via python I get following error:
import mycode

ImportError: ./mycode.so: undefined symbol: PyInstanceMethod_Type

Any ideas what the problem may be?

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