Skip to content

Why the same code can be built and installed on Linux and macOS but not on Windows? #96

@sun1638650145

Description

@sun1638650145

I can use python setup.py install to install on Linux or macOS, but it will report an error on Windows. And this kind of error will only happen if you add a directory structure to the cpp source code, like the following pybind_example/backend/ops.cc (if it is such a structure pybind_example/ops.cc, you can successful compilation).
截屏2021-12-13 下午7 22 42
The following is the error message:

LINK : error LNK2001: unresolved external symbol PyInit_pybind_example/backend/ops
build\temp.win-amd64-3.7\Release\pybind_example/backend\ops.cp37-win_amd64.lib : fatal error LNK1120: 1 unresolved externals
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\link.exe' failed with exit status 1120

I have been confused for three days, and the same error appears when using skbuild. I am a newbie in windows development.

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