pybind / cmake_example

Example pybind11 module built with a CMake-based build system
Other
626 stars 220 forks source link

python file can't import module after change pybind target name #61

Open argentea opened 3 years ago

argentea commented 3 years ago

I move the test_basic.py to project root directory and change the import path. Then, I change the target name in CMakeLists.txt and module name in test_basic.py. Then, "mkdir build; cd build; cmake ...; make", and everything goes well. However, when i run the test_basic.py, I get "Traceback (most recent call last): File "test_basic.py", line 2, in import build.bind_example as m ImportError: dynamic module does not define module export function (PyInit_bind_example) ".

Besides, when I change the target name back to cmake_example, the python file import module normally,

Attached files is the version which target name is changed. CMakeLists.txt