C++ invoks Python ~ int64_t and __int64
来源:互联网 发布:大数据应用案例分析 编辑:程序博客网 时间:2024/05/21 17:21
#include <Python.h>
int main() {
return 0;
}
利用如上代码(cpppython.cc)测试C++调用python(version 2.6.2),g++编译出现如下错误:
通过错误可知__int64不是C++的支持的整型类型。
那C语言支不支持呢?
#include <stdio.h>
int main() {
/*
long long a = 100;
printf("%lld", a);
printf("size of long long is %d", sizeof(long long));
*/
__int64 b = 100;
printf("%I64d", b);
return 0;
}
GCC编译以上代码后出现如下错误
在MSVC++中以上两段代码都可以编译通过。
#include <stdio.h> #include <stdlib.h> int main(void) { int64_t b = 100; printf("%d", b); return EXIT_SUCCESS; }
以上代码GCC可编译通过,MSVC++编译不过 在头文件stdint.h(Copyright 2003, 2006, 2007 Red Hat, Inc.)中定义了如下宏
typedef signed char int8_t;
typedef short int16_t;
typedef int int32_t;
typedef long long int64_t;
在C99标准中,long long int 是五个标准有符号整型之一。
由以上可知int64_t与MSVC++中的__int64是等价的,只是__int64在MSVC++中是内置类型。
在引用头文件Python.h之前,添加
typedef long long __int64;
编译依然出错,看来只能在MSVC++中使用Python2.6.2了,或者升级Python了。
- C++ invoks Python ~ int64_t and __int64
- int64_t
- C 中 __int64用法
- C/C++中的64位整数(__int64 and long long)
- C/C++中的64位整数(__int64 and long long)
- C/C++中的64位整数(__int64 and long long)
- C/C++中的64位整数(__int64 and long long)
- C/C++中的64位整数(__int64 and long long)
- C 语言__int64的使用
- __int64
- __int64
- __int64
- python and C
- python and c/c++
- c语言一些默认i_ __int64
- Modulo in Python and C
- C语言中long long的用法 C++ __int64用法 __int64的printf问题
- difirence for java php and js and c and python
- where "__moddi3" comes from
- 2011年2月18个最给力jQuery教程分享
- Linux Ubuntu ssh start
- 如何选择STL容器?
- JAVA设计模式之Observer模式
- C++ invoks Python ~ int64_t and __int64
- eclipse远程调试websphere
- 王者归来
- linux环境变量介绍
- 使用MD5对密码进行加密
- 获取进程用户名
- style、 currentStyle、 runtimeStyle区别分析
- 分享20个漂亮强大的jQuery导航菜单
- Unity3D File Based Assetbundles on the iPhone