c - 编译 SWIG 的包装器模块输出时出现 6 个错误?

标签 c perl swig

gcc -fpic -c gd_wrap.c -Dbool=char -I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE :

In file included from /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/op.h:499,
                 from /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/perl.h:2754,
                 from gd_wrap.c:731:
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/reentr.h:612: error: field ‘_crypt_struct’ has incomplete type
In file included from /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/perl.h:3950,
                 from gd_wrap.c:731:
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/proto.h:297: error: expected declaration specifiers or ‘...’ before ‘off64_t’
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/proto.h:299: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Perl_do_sysseek’
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/proto.h:300: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Perl_do_tell’
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/proto.h:2009: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before Perl_PerlIO_tell’
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/proto.h:2010: error: expected declaration specifiers or ‘...’ before ‘off64_t’

有人熟悉这个错误吗?

我使用的是 Centos 5.5,perl 版本是 5.8.8

最佳答案

这是一个众所周知的错误(只需在 google 上搜索关键字 Perl_do_sysseek 和 swig 即可。

我过去发现了两种解决方案。

第一个确实很脏(我鄙视它),但可以 100% 工作。它包括在“proto.h”文件的顶部添加以下几行:

#include <stdint.h>
typedef __off64_t off64_t;

第二个系统比第一个系统更干净。您应该将 swig 升级到版本 2.0 并重试。如果不起作用,您可以尝试将 perl 升级到版本 5.10.0。

关于c - 编译 SWIG 的包装器模块输出时出现 6 个错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6493322/

相关文章:

perl - 替换多行纯文本

amqp 上的 C 二进制消息

c - openMP 程序中的嵌套 for 循环花费的时间太长

C-GTK-g_application_quit

perl - 如何将 RRDtool 图的图例中的字段与 Perl 对齐?

c++ - Swig:如何将指针列表从 C++ 返回到 Tcl

c - C 中位掩码的使用

Perl 无法尾部旋转日志文件

python - SWIG 将 map vector 转换为 python 字典列表

c - 用 SWIG 包装 C 结构