cython - Cython 编译警告不兼容类型
问题描述
我正在尝试在 cython 中使用 ac DLL,在编译阶段我收到了来自 C 编译器的警告:
warning C4133: "=" : incompatible types - from 'foobar *' to 'foobar *'
.
我的 pxd 看起来像这样:
#!/usr/bin/env python3
#cython: language_level=3
cdef extern from "typedef.h"
struct foobar:
long *index
double *my_array
int value
cdef extern from "functions.h"
foobar *get_foobar(char *name);
我的 pyx 就是这样:
cimport pxd_file_name
cdef class Handler:
cdef pxd_file_name.foobar *__foobar
def load_foobar(self, char *name):
self.__foobar = pxd_file_name.get_foobar(name) <==
def another_method(self):
pass
由于箭头标记的线,我收到了警告,但我不明白为什么。
有没有办法来解决这个问题 ?
解决方案
我设法找到了我的错误。
因为在我的 .h 文件中,我的结构是使用 typedef 声明的,所以我必须写ctypedef struct foobar
而不是struct foobar
在我的 pxd 文件中
推荐阅读
- python - django 从查询集值中区分查询集
- javascript - 将 Bing Map Autosuggest API 添加到表单中的多个字段
- python - Python 如何处理来自“其他地方”的对象
- c# - 在 C# 中减去整数时出现错误“无法将 int 隐式转换为 short”
- java - Spring Boot 管理配置
- ruby-on-rails - 简单表单删除关联记录
- python - 如何使用 Python 对 SQL 源数据和 SQL 目标数据进行批处理/分块?
- r - 如何使用正则表达式匹配一个人的头衔
- python - biopython中成对爆炸的问题
- c# - 如何使用实体框架查询外键对象?