C 中的编译错误 : Inconsistent type declaration/Illegal redeclaration for identifier

标签 c unix compilation hp-ux

我在编译源代码时遇到以下错误:

Compiling lib/netapi/joindomain.c
cc: "include/smb_ldap.h", line 33: error 1584: Inconsistent type declaration: "ber_tag_t".
cc: "include/smb_ldap.h", line 34: error 1713: Illegal redeclaration for identifier "ber_int_t".
The following command failed:
)
*** Error exit code 1

标记错误的相应代码是:

if HAVE_LBER_H
#include <lber.h>
#if defined(HPUX) && !defined(_LBER_TYPES_H)
#ifndef ber_tag_t
typedef unsigned long ber_tag_t;
typedef int ber_int_t;
#endif
#endif 

我请求帮助了解此错误的根本原因。

提前致谢。

以下是我的机器和编译器详细信息供引用:

$  uname -a
HP-UX cifsvade B.11.31 U 9000/800 3751280844 unlimited-user license
$  which cc
/usr/bin/cc
$  ls -lrt /usr/bin/cc
lrwxr-xr-x   1 root       sys             17 Oct  8 17:45 /usr/bin/cc -> /opt/ansic/bin/cc
$ 

最佳答案

lber.h定义ber_tag_t和ber_tag_t如下:

    typedef impl_tag_t ber_tag_t;
    typedef impl_int_t ber_int_t;

在你的代码中你尝试重新定义它们,就是这种情况。 一个条件

    #ifndef ber_tag_t

始终为真,除非您在类似

的地方定义了 ber_tag_t
    #define ber_tag_t smth

关于C 中的编译错误 : Inconsistent type declaration/Illegal redeclaration for identifier,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14480450/

相关文章:

matlab - 从 Unix shell 读取 .mat 文件

linux - 如何从命令行访问 Unix 域套接字?

c - sigaction()中第二个结构(* oldact)的用途是什么

gcc - 什么是 GCC lto 包装器?

c++ - 在 C++ 中,严格的自底向上分析如何暗示返回类型不用于重载决策?

c - http服务器如何从客户端接收文件

c - 我的 "Vigenere CS 50"项目运行不正常

gradle - 如何在 settings.gradle 文件中声明构建脚本、依赖项和插件?

c - 如果 2 个不同的进程同时对同一个文件调用写系统调用会发生什么

c - 我的嵌套循环打印的行比想要/预期少了一行