在编译过程中遇到问题 [英] facing problem during compilation

查看:68
本文介绍了在编译过程中遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们,


我已将以下两行放在一个头文件中,以防止它被多次包含在内。




#ifndef __MY_HDR.H__

#define __MY_HDR.H__


//这里有些宏


#endif


但是,当我编译代码时,我收到以下警告,

警告:#ifndef指令末尾的额外令牌

警告ISO C在宏名称后需要空格

任何人都可以帮我找到问题吗?


对于任何人都有很大的帮助帮助。

Guys,

I have put the following two lines in a header file to prevent it
from getting included multiple times.

#ifndef __MY_HDR.H__
#define __MY_HDR.H__

// Some macros here

#endif

However, when I compile the code, I am getting following warnings,
warning: extra token at end of #ifndef directive
warning ISO C requires whitespace after the macro name
Can anyone help me finding the problem ?

thnaks a lot for any help.

推荐答案

< ju ********** @ yahoo.co.inschrieb im Newsbeitrag

新闻:11 ********************** @ q3g2000prf.googlegro ups.com ...
<ju**********@yahoo.co.inschrieb im Newsbeitrag
news:11**********************@q3g2000prf.googlegro ups.com...

伙计们,


我把以下两行放在一个头文件中,以防止它多次被包含在内。

。 br />

#ifndef __MY_HDR.H __

#define __MY_HDR.H__


//这里有些宏


#endif

但是,当我编译代码时,我收到以下警告,

警告:#ifndef指令末尾的额外令牌

警告ISO C需要空格在宏名称之后


任何人都可以帮我找到问题吗?
Guys,

I have put the following two lines in a header file to prevent it
from getting included multiple times.

#ifndef __MY_HDR.H__
#define __MY_HDR.H__

// Some macros here

#endif

However, when I compile the code, I am getting following warnings,
warning: extra token at end of #ifndef directive
warning ISO C requires whitespace after the macro name
Can anyone help me finding the problem ?



猜猜它是抱怨的。

另外你不应该是以_开头的usign宏或标识符,他们

已经重新执行,所以请尝试MY_HDR_H或MY_HDR_H_


再见,Jojo

Guess it''s complaining about the .
Also you shouldn''t be usign macros or identifiers that start with an _, they
are resoved for the implementation, so try MY_HDR_H or MY_HDR_H_ instead

Bye, Jojo


ju**********@yahoo.co.in 写道:
ju**********@yahoo.co.in wrote:

伙计们,


我已将以下两行放在一个头文件中以防止它

$多次被收录。


#ifndef __MY_HDR.H__

#define __MY_HDR.H__


//这里有一些宏


#endif


然而,当我编译代码时,我收到以下警告,

警告:#ifndef指令末尾的额外令牌

警告ISO C在宏名称后需要空格


有谁能帮我找到问题?


thnaks很多任何帮助。
Guys,

I have put the following two lines in a header file to prevent it
from getting included multiple times.

#ifndef __MY_HDR.H__
#define __MY_HDR.H__

// Some macros here

#endif

However, when I compile the code, I am getting following warnings,
warning: extra token at end of #ifndef directive
warning ISO C requires whitespace after the macro name
Can anyone help me finding the problem ?

thnaks a lot for any help.



您写道:


__MY_HDR.H__


这个点不是标识符,你不能把点写入

一个标识符。然后,编译器看到

__MY_HDR。 H__

当然这不是一个有效的#ifndef指令。


解决方案

更改

__MY_HDR.H__到:


__MY_HDR_H__


摆脱这一点。

You wrote:

__MY_HDR.H__

The point is NOT an identifier, you can''t write points into
an identifier. Then, the compiler sees
__MY_HDR . H__
This is NOT a valid #ifndef directive of course.

Solution
Change
__MY_HDR.H__ to:

__MY_HDR_H__

getting rid of the point.


On Fri,2007年9月21日05:50:28 -0700,
ju **********@yahoo.co.in < ju ********** @ yahoo.co.inwrote:
On Fri, 21 Sep 2007 05:50:28 -0700,
ju**********@yahoo.co.in <ju**********@yahoo.co.inwrote:

伙计们,


我已经将以下两行放在一个头文件中,以防止它多次被包含在内。

。 />

#ifndef __MY_HDR.H__

#define __MY_HDR.H__
Guys,

I have put the following two lines in a header file to prevent it
from getting included multiple times.

#ifndef __MY_HDR.H__
#define __MY_HDR.H__



你不能使用预处理器宏标识符(或任何

其他标识符)的完整停止。你可以使用字母(英文字母),

数字和下划线,第一个字符不能是数字。


你也可以不应该用下划线开始,然后用

另一个下划线或大写字母,因为所有这些标识符

都是保留的,不适用于程序员。


使用类似的东西:


#ifndef MY_HDR_H

#define MY_HDR_H


Martien

-

|

Martien Verbruggen | 在没有围栏的世界里,

|谁需要盖茨?

|

You can''t use a full stop in a preprocessor macro identifier (or any
other identifier). You can use letters (from the english alphabet),
digits and the underscore, and the first character can''t be a digit.

You also shouldn''t start then with an underscore and follow that with
another underscore or an uppercase letter, as all of those identifiers
are reserved, and not for use by the programmer.

Use something like:

#ifndef MY_HDR_H
#define MY_HDR_H

Martien
--
|
Martien Verbruggen | "In a world without fences,
| who needs Gates?"
|


这篇关于在编译过程中遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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