找回密码
 立即注册

扫一扫,访问微社区

QQ登录

只需一步,快速开始

查看: 1889|回复: 0

[求助] Cython生成c文件,然后c++调用问题

1

主题

2

帖子

2

积分

贫民

积分
2
renmenziji 发表于 2019-2-27 10:19:42 | 显示全部楼层 |阅读模式
Cython生成c文件,然后c++调用问题.

本人使用py生成test文件代码如下:
# cython: language_level=3, boundscheck=False
cdef public ml_lith():
    print("hello world")
       
使用cython test.pyx命令生成了test.h test.c两个文件
导入工程中.main.cpp如下


#include <stdio.h>
#include <python.h>
#include "test.h"
int main(int argc, char *argv[])
{

        Py_Initialize();
        if (!Py_IsInitialized()) {
                return 1;
        }
        PyInit_test();
        testcy( );
        Py_Finalize();

        return 1;
}


当运行到testcy( );就报错.
运行环境为python3.72.我重新测试了python3.5.也是如此
请教一下是哪里出问题了呢?谢谢大家!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表