C函数的声明 - 冲突 [英] declaration of C function - conflicts

查看:218
本文介绍了C函数的声明 - 冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我有一些C ++代码可以构建2个头文件,其中包含

相同的函数名声明(gethostname)。

不直接包含头文件。它们包含在

其他头文件中。


如何解决此错误?


错误( GCC 3.3.2 on Solaris 9):

/usr/include/unistd.h:278:错误:C函数的声明`int

gethostname(char *,unsigned int)''与
冲突
... / .. / .. / webserver_api / apache / SunOS / include / ap_config.h:189:错误:

previous

声明`int gethostname(char *,int)''这里

解决方案

* rh ****** @ tampabay.rr.com

你好,
我有一些C ++代码,它们构建了2个包含
相同函数名声明(gethostname)的头文件。
头文件不是直接包含的。它们通过
其他头文件包含在内。

如何解决此错误?

错误(Solaris 9上的GCC 3.3.2):
/usr/include/unistd.h:278:错误:声明C函数`int
gethostname(char *,unsigned int)''与
../../../webserver_api冲突/apache/SunOS/include/ap_config.h:189:错误:
上一个
声明`int gethostname(char *,int)''here




查看PIMPL模式。


-

答:因为它弄乱了人们通常阅读文本的顺序。

问:为什么这么糟糕?

A:热门发布。

问:usenet和e-最令人烦恼的是什么? mail?


rh******@tampabay.rr .com 写道:

我有一些C ++代码,它们构建了2个包含
相同函数名声明(gethostname)的头文件。
T他的头文件没有直接包含在内。它们通过
其他头文件包含在内。

如何解决此错误?

错误(Solaris 9上的GCC 3.3.2):
/usr/include/unistd.h:278:错误:声明C函数`int
gethostname(char *,unsigned int)''与
../../../webserver_api冲突/apache/SunOS/include/ap_config.h:189:错误:
上一个
声明`int gethostname(char *,int)''here




通过定义哪个将禁用其中一个

冲突声明来查找(或创建)宏。然后仅为模块定义该宏

在编译时给出错误。


V

-

请在通过电子邮件回复时删除资金''A'

我没有回复最热门的回复,请不要问


你自己构建了源代码吗?

是Apache系统的二进制文件,也是支持的

库。这样的事情应该在配置

过程中处理好吗?


-SIGTERM

amit


Hello,
I have some C++ code that builds against 2 headers files that contain
the same function name declaration (gethostname).
The header files are not directly included. They are included via
other header files.

How can I resovle this error?

The error (GCC 3.3.2 on Solaris 9):
/usr/include/unistd.h:278: error: declaration of C function `int
gethostname(char*, unsigned int)'' conflicts with
.../../../webserver_api/apache/SunOS/include/ap_config.h:189: error:
previous
declaration `int gethostname(char*, int)'' here

解决方案

* rh******@tampabay.rr.com:

Hello,
I have some C++ code that builds against 2 headers files that contain
the same function name declaration (gethostname).
The header files are not directly included. They are included via
other header files.

How can I resovle this error?

The error (GCC 3.3.2 on Solaris 9):
/usr/include/unistd.h:278: error: declaration of C function `int
gethostname(char*, unsigned int)'' conflicts with
../../../webserver_api/apache/SunOS/include/ap_config.h:189: error:
previous
declaration `int gethostname(char*, int)'' here



Look up the PIMPL pattern.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?


rh******@tampabay.rr.com wrote:

I have some C++ code that builds against 2 headers files that contain
the same function name declaration (gethostname).
The header files are not directly included. They are included via
other header files.

How can I resovle this error?

The error (GCC 3.3.2 on Solaris 9):
/usr/include/unistd.h:278: error: declaration of C function `int
gethostname(char*, unsigned int)'' conflicts with
../../../webserver_api/apache/SunOS/include/ap_config.h:189: error:
previous
declaration `int gethostname(char*, int)'' here



Find (or create) a macro by defining which you will disable one of the
conflicting declarations. Then define that macro only for the module
that gives you the error when compiled.

V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask


Did u build the source urself ?
Is the binary of the Apache for ur system as also the supporting
libraries. Things like this should be taken care of in the configure
process ?

-SIGTERM
amit


这篇关于C函数的声明 - 冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆