为Python创建C 扩展
Creating a C++ extension for Python
当我按照创建python创建C 扩展的指令时,我不会遇到任何错误>。
我经过本节的步骤并尝试构建解决方案,我偶然发现了这一点:
1>------ Build started: Project: CppMain, Configuration: Debug Win32 ------
1>module.cpp
1> Creating library C:Users$anduDesktopCpp4PyDebugCpp4Py.lib and object C:Users$anduDesktopCpp4PyDebugCpp4Py.exp
1>module.obj : error LNK2019: unresolved external symbol __imp__PyFloat_FromDouble referenced in function "struct _object * __cdecl tanh(struct _object *,struct _object *)" (?tanh@@YAPAU_object@@PAU1@0@Z)
1>module.obj : error LNK2019: unresolved external symbol __imp__PyFloat_AsDouble referenced in function "struct _object * __cdecl tanh(struct _object *,struct _object *)" (?tanh@@YAPAU_object@@PAU1@0@Z)
1>module.obj : error LNK2019: unresolved external symbol __imp__PyModule_Create2 referenced in function _PyInit_Cpp4Py
1>C:PythonAnaconda3libspython3.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
1>C:Users$anduDesktopCpp4PyDebugCpp4Py.pyd : fatal error LNK1120: 3 unresolved externals
1>Done building project "CppMain.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
从上面的消息中,我怀疑问题来自该指令中的步骤2。但是我真的不知道该如何处理。有什么建议吗?
我与X64 Windows 10一起工作。
我不确定。但是您可以将项目的目标机类型更改为X64,然后重试。请参阅此警告:
c: python anaconda3 libs python3.lib:警告lnk4272:库机器类型'x64'与目标机器类型'x86'
冲突
相关文章:
- 我想通过带有C++和Python的插件创建一个可扩展的应用程序
- 如何从C++扩展的QQuickItem创建QQuickWindow作为子窗口?
- 如何创建独立于平台的宏来包装编译器扩展?
- 从函数为 std::vector 创建自定义扩展
- 将 int 转换为字符串,然后连接另一个变量以创建完整扩展名,然后将其转换为 const_char*
- RXCPP:创建一个不关心可观察量输入类型的扩展
- 动态创建和扩展STD ::元组为参数包
- 如何在代码中创建抽象类,让蓝图扩展它,并将该蓝图返回给代码进行实例化?
- C MakeFile项目如何使用相同的Basename加上后缀和相同扩展名创建文件列表
- 创建两个可变非类型模板参数包的笛卡尔乘积扩展
- 为Python创建C 扩展
- Vulkan-加载扩展时实例创建失败
- 如何在Windows中创建扩展(自定义)文件属性
- 如何创建一个不敏感的正则态度以匹配文件扩展名
- OSX创建C 内核扩展
- Python扩展在操作大列表时会创建无效指针
- 在 c++ 中创建自定义控件时扩展控件
- 在C中创建Ruby扩展时出错
- 创建 Ruby C++扩展
- 在c++中,当我们创建一个类而不扩展到任何类时