这个宏有什么问题 [英] what's wrong with the macro

查看:56
本文介绍了这个宏有什么问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



#include< stdio.h>

#include< stdlib.h>

#include< string.h>


#define SECONDS_PER_YEAR(60 * 60 * 24 * 365)UL

int main()

{

unsigned long int u_i = SECONDS_PER_YEAR;

printf("%lu \ n",u_i);


返回0;

}

cc -g -c -Wall -std = c99 -DDEBUG define.c

define.c:在函数''main'':

define.c:17:错误:预期'',''或'';''在''UL'之前'

make:*** [define.o ]错误1


#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define SECONDS_PER_YEAR (60*60*24*365)UL
int main()
{
unsigned long int u_i = SECONDS_PER_YEAR;
printf("%lu\n",u_i);

return 0;
}
cc -g -c -Wall -std=c99 -DDEBUG define.c
define.c: In function ''main'':
define.c:17: error: expected '','' or '';'' before ''UL''
make: *** [define.o] error 1

推荐答案

限定符必须直接跟随数字。


-
www.personal.leeds.ac.uk/~bgy1mm

免费软件游戏下载。


" DaVinci" < ap *********** @ gmail.comwrote in message

news:11 ******************* **@m73g2000cwd.googlegro ups.com ...
The qualifer must follow the digits directly.

--
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.

"DaVinci" <ap***********@gmail.comwrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...

>

#include< stdio.h>

#include< stdlib.h>

#include< string.h>


#define SECONDS_PER_YEAR(60 * 60 * 24 * 365)UL

int main()

{

unsigned long int u_i = SECONDS_PER_YEAR;

printf("%lu \ n",u_i);


返回0;

}

cc -g -c -Wall -std = c99 -DDEBUG define.c

define.c:在函数''main'':

define.c:17:error:expected'',''或' ''''在''UL'之前'

make:*** [define.o]错误1
>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define SECONDS_PER_YEAR (60*60*24*365)UL
int main()
{
unsigned long int u_i = SECONDS_PER_YEAR;
printf("%lu\n",u_i);

return 0;
}
cc -g -c -Wall -std=c99 -DDEBUG define.c
define.c: In function ''main'':
define.c:17: error: expected '','' or '';'' before ''UL''
make: *** [define.o] error 1



Malcolm发布:
Malcolm posted:

qualifer必须直接跟随数字。
The qualifer must follow the digits directly.



可以简单地改为:


#define SECONDS_PER_YEAR(60LU * 60 * 24 * 365)

-


Frederick Gotham

It can be changed to simply:

#define SECONDS_PER_YEAR(60LU*60*24*365)

--

Frederick Gotham




" Frederick Gotham < fg ******* @ SPAM.comha scritto nel messaggio

新闻:Vf ******************* @ news。 indigo.ie ...

"Frederick Gotham" <fg*******@SPAM.comha scritto nel messaggio
news:Vf*******************@news.indigo.ie...

Malcolm发布:
Malcolm posted:

资格者必须直接跟随数字。
The qualifer must follow the digits directly.



可以简单地改为:


#define SECONDS_PER_YEAR(60LU * 60 * 24 * 365)



需要空间


#define SECONDS_PER_YEAR(60LU * 60 * 24 * 365)

- -

Giorgio Silvestri

DSP /嵌入式/实时操作系统软件工程师

A space is necessary

#define SECONDS_PER_YEAR (60LU*60*24*365)
--
Giorgio Silvestri
DSP/Embedded/Real Time OS Software Engineer


这篇关于这个宏有什么问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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