在 msys2-mingw 上使用 Python/C API
use Python/C API on msys2-mingw
我尝试在msys2-mingw上使用Python/C API,所以我安装了这个包mingw-w64-x86_64-python2
,我写main.cpp
:
#include <python2.7Python.h>
int main(){
return 0;
}
当我进入这个$ g++ main.cpp -o main
时,它给了我这些味精:
In file included from msys64mingw64include/python2.7Python.h:58:0,
from main.cpp:1:
msys64mingw64include/python2.7pyport.h:907:2: 錯誤:#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
^
In file included from msys64mingw64include/python2.7Python.h:8:0,
from main.cpp:1:
/usr/include/cygwin/types.h:78:20: 錯誤:一個宣告指定了多個類型
typedef __uint32_t uid_t;
^
/usr/include/cygwin/types.h:78:20: 錯誤:沒有宣告任何東西 [-fpermissive]
/usr/include/cygwin/types.h:84:20: 錯誤:一個宣告指定了多個類型
typedef __uint32_t gid_t;
^
/usr/include/cygwin/types.h:84:20: 錯誤:沒有宣告任何東西 [-fpermissive]
makefile:2: recipe for target 'main' failed
make: *** [main] Error 1
我不知道为什么会发生这种情况。这不是关于linking file
的错误(因为我没有链接任何文件。我的方法有误,还是包含错误的文件?
你混合了GCC:mingw-w64 GCC和msys GCC。对于 MSYS2 下的 mingw-w64 GCC,您不得包含来自/usr 的内容。查看您的错误消息/usr/include/cygwin/types.h
相关文章:
- 如何将真正的字符串从python c-api转换为python脚本
- 使用 Python Extension API 包装复杂C++类
- Python to C++ Data structure API
- Python C API:使用 MSVC 尝试示例模块时的访问冲突
- xgboost C API 不会产生与 Python 相同的结果
- 如何仅使用 c/python API 将 c++ 成员函数绑定到 python?
- 如何从主线程正确释放 Python C API GIL
- Python API用于解析包含数组格式的protobuf数据的二进制文件
- Windows API "CreateWindowEx" 在 Python (3.6.8) 64 位使用的 DLL 中工作吗?
- 如何在TensorFlow C API(例如Python)中设置轴
- Valgrind 错误和内存泄漏与 Python/C API
- Python C API-具有可变的参数数量的过载函数
- 使用Python C API时的奇怪记忆行为
- Python C API:如何检查对象是否是类型的实例
- Python C API-返回功能超载中的不同类型
- 如何使用纯Python扩展API(Python3)包裹C 对象
- Python C API:如何访问公共类属性
- 在Python中使用UEYE API
- Python C API:PyDateTime_FromTimestamp会导致分段错误
- 彭博API Python 3.5.5与C++3.8.1.1.在Mac OS X上导入blpapi引用