嵌入式Cython UCS2 UCS4问题
Embedded Cython UCS2 UCS4 issue
我有一些python代码,我正试图使用cython-api构造嵌入c++代码中。出于测试目的,我一直在工作:Cython作为Python到C转换器的示例程序
代码略有修改:
#foo.pyx
cdef public foo(double* x):
x[0] = 0.0
//file.cpp
#include "Python.h"
#include "foo.h"
#include <iostream>
int main(int argc, const char * argv[])
{
double arr[2] = {1,2};
foo(arr);
std::cout << arr[0] << std::endl;
std::cout << arr[1] << std::endl;
}
运行后
cython foo.pyx
我试图编译接收到的错误消息:
foo.c:(.text+0x387): undefined reference to 'PyUnicodeUCS4_DecodeUTF8'
我已经看到了关于这个问题的其他问题,比如Cythnized纯Python模块的UCS2-UCS4不兼容导入失败,以及当我运行时:
import sys; sys.maxunicode
我得到1114111,这与UCS4一致。因此,我想知道的是,当我的python版本似乎与正确的UCS一致,但在其他地方不一致时,如何解决这个未定义的引用。
原来我的系统上安装了两个不同的python,但我链接错了一个。
相关文章:
- 警告处理为错误这里有什么问题
- 最小硬币更换问题(自上而下方法)
- 为"adjacent"变量赋值时出现问题
- 我的神经网络不起作用 [XOR 问题]
- 在Ubuntu 16.04上安装Cilk时出现问题
- C++我的数学有什么问题,为什么我的代码不能正确循环
- 编译包含字符串的代码时遇到问题
- Project Euler问题4的错误解决方案
- 问题:什么是QAbstractItemView::NoEditTriggers的反面
- 在编译C++代码(具有dlib和opencv)到WASM时面临问题
- 在进程中对同一管道进行读取和写入时C++管道出现问题
- 静态数据成员的问题-修复链接错误会导致编译器错误
- C++ 雷神库 - 使用资源加载器类时出现问题(不命名类型)
- 一个关于在C++中重载布尔运算符的问题
- 首要问题的答案让值班员搞错了
- setlocale的C++土耳其字符串问题
- 如何重构类层次结构以避免菱形问题
- 基于boost的程序的静态链接——zlib问题
- C++格式化输出问题
- 嵌入式Cython UCS2 UCS4问题