“extern struct foobar” linux编译警告 [英] "extern struct foobar" linux compilation warning

查看:68
本文介绍了“extern struct foobar” linux编译警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部,


我在LINUX上收到以下编译错误

(但不是Solaris,HPUX,WIN32等):


编译osr.c

LBFO.h(369):警告#64:声明没有声明任何内容

extern struct foobar;

^


这显然是对数据结构的前向引用

,用于声明指向此不透明的指针
结构。


任何想法如何摆脱这个警告???


提前谢谢!

Rick

解决方案

BTW:这是icc (英特尔编译器)*不*

gcc ...


看来-fms_extensions编译器选项不受支持。


FYI


谢谢!

Rick


留言< Xn *** *******************************@148.87.1.5 3>

Rick Anderson< Ri **************@oracle.com>写道:

我在LINUX上收到以下编译错误
(但不是Solaris,HPUX,WIN32等):

编译osr。 c
LBFO.h(369):警告#64:声明没有声明任何东西
extern struct foobar;
^

这显然是一个前向引用数据结构
用于声明指向这个不透明结构的指针。

任何想法如何摆脱这个警告???




删除extern。除非你真的声明了一个

对象,否则它就没有意义了。你只是命名一种结构类型。


-

Kevin Bracey,首席软件工程师

Tematic Ltd电话: +44(0)1223 503464

182-190 Newmarket Road传真:+44(0)1728 727430

剑桥,CB5 8HE,英国WWW: http://www.tematic.com/


< blockquote> Rick Anderson写道:

全部,

我在LINUX上收到以下编译错误
(但不是Solaris,HPUX,WIN32等):<编译osr.c
LBFO.h(369):警告#64:声明没有声明任何东西
extern struct foobar;
^


extern struct foobar baz;


是有道理的。


struct foobar;


是有意义的。

extern与对象一起使用,而不是类型。


这显然是对数据结构的前向引用,用于声明指向这个不透明结构的指针。


是吗?


如果确实需要不透明的东西,

请使用void *:


typedef void * FooBarHandle;


用户只获得句柄,甚至看看

typedef不知道如何以及在何处存储信息。

如果可信任用户不会绕过您的访问

宏和功能(并且您的数据结构不是

最高机密),头文件给出类型定义

forstruct foobar应该包括在内。

任何想法如何摆脱这个警告???




治愈代码。

干杯

Michael

-

电子邮件:我的是/ at / gmx / dot / de地址。

All,

I am receiving the following compilation error on LINUX
(but not Solaris, HPUX, WIN32, etc):

compiling osr.c
LBFO.h(369): warning #64: declaration does not declare anything
extern struct foobar;
^

This is apparently a forward reference to a data structure
for the purposes of declaring a pointer to this opaque
structure.

Any ideas how to get rid of this warning???

Thanks in advance!
Rick

解决方案

BTW: This is the "icc" (intel compiler) *not*
gcc...

It appears -fms_extensions compiler option is not supported.

FYI

Thanks!
Rick


In message <Xn**********************************@148.87.1.5 3>
Rick Anderson <Ri**************@oracle.com> wrote:

I am receiving the following compilation error on LINUX
(but not Solaris, HPUX, WIN32, etc):

compiling osr.c
LBFO.h(369): warning #64: declaration does not declare anything
extern struct foobar;
^

This is apparently a forward reference to a data structure
for the purposes of declaring a pointer to this opaque
structure.

Any ideas how to get rid of this warning???



Remove the "extern". It''s meaningless unless you''re actually declaring an
object, which you''re not. You''re merely naming a structure type.

--
Kevin Bracey, Principal Software Engineer
Tematic Ltd Tel: +44 (0) 1223 503464
182-190 Newmarket Road Fax: +44 (0) 1728 727430
Cambridge, CB5 8HE, United Kingdom WWW: http://www.tematic.com/


Rick Anderson wrote:

All,

I am receiving the following compilation error on LINUX
(but not Solaris, HPUX, WIN32, etc):

compiling osr.c
LBFO.h(369): warning #64: declaration does not declare anything
extern struct foobar;
^
extern struct foobar baz;

would make sense.

struct foobar;

can make sense.
"extern" goes with objects, not with types.

This is apparently a forward reference to a data structure
for the purposes of declaring a pointer to this opaque
structure.
Is it?

If it is really necessary to get something opaque,
use void *:

typedef void * FooBarHandle;

The user gets only the handle and even a look at the
typedef does not tell how and where information is stored.
If the user can be trusted to not circumvent your access
macros and functions (and your data structures are not
top secret), the header file giving the type definition
for "struct foobar" should be included.
Any ideas how to get rid of this warning???



Heal the code.
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.


这篇关于“extern struct foobar” linux编译警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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