用多久 [英] using long long

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

问题描述



为什么代码没有编译?我正在使用SuSe linux。

是这样的吗?


#include< stdio.h>

int main()

{

很长我;

i = LL 9876543219;

printf("%ld \ n",i);

}

错误信息是


longLong.cpp:6:错误:整数常量对于long而言太大了类型

longLong.cpp:6:错误:`LL''未声明(首先使用此函数)

longLong.cpp:6:错误:(报告每个未声明的标识符只有

一次为

它出现的每个函数。)

longLong.cpp:6:错误:数字常量之前的语法错误


提前致谢

Kiran。

Hi,
Why is the code not getting compiled ? I am using SuSe linux. Is
it becuase of that ?

#include<stdio.h>
int main()
{
long long i;
i = LL 9876543219;
printf("%ld\n", i);
}
Error message is

longLong.cpp:6: error: integer constant is too large for "long" type
longLong.cpp:6: error: `LL'' undeclared (first use this function)
longLong.cpp:6: error: (Each undeclared identifier is reported only
once for
each function it appears in.)
longLong.cpp:6: error: syntax error before numeric constant

Thanks in advance
Kiran.

推荐答案

jithoosin写道:
jithoosin wrote:



为什么代码没有被编译?我正在使用SuSe linux。

是这样的吗?


#include< stdio.h>

int main()

{

很长我;

i = LL 9876543219;
Hi,
Why is the code not getting compiled ? I am using SuSe linux. Is
it becuase of that ?

#include<stdio.h>
int main()
{
long long i;
i = LL 9876543219;



''LL''*在*之后*:


i = 9876543219LL;


The ''LL'' goes *after* the number:

i = 9876543219LL;


printf("%ld \ n",i);

}

printf("%ld\n", i);
}



这些错误消息(以及文件的.cpp后缀)告诉我

您将此代码编译为C ++,而不是C.请注意它们是

两种不同的语言,并且有不同的规则(例如,''long

long''还不是C ++中的标准类型,这就是C ++警告你的原因/>
关于对于''long'来说太大的值。)

These error messages (and the ".cpp" suffix of your files) suggest to me
that you''re compiling this code as C++, not C. Be aware that they are
two different languages, and have different rules (for instance, ''long
long'' is not yet a standard type in C++, which is why C++ warns you
about values that are too large for ''long'').


错误信息是


longLong.cpp:6:错误:整数常量对于long而言太大类型

longLong.cpp:6:错误:`LL''未声明(首先使用此函数)

longLong.cpp:6:错误:(报告每个未声明的标识符只有

一次为

它出现的每个函数。)

longLong.cpp:6:错误:数字常量之前的语法错误


提前致谢

Kiran。
Error message is

longLong.cpp:6: error: integer constant is too large for "long" type
longLong.cpp:6: error: `LL'' undeclared (first use this function)
longLong.cpp:6: error: (Each undeclared identifier is reported only
once for
each function it appears in.)
longLong.cpp:6: error: syntax error before numeric constant

Thanks in advance
Kiran.



-

Clark S 。考克斯三世
cl*******@gmail.com


jithoosin说:
jithoosin said:



为什么代码没有被编译?我正在使用SuSe linux。

这是因为这个?
Hi,
Why is the code not getting compiled ? I am using SuSe linux. Is
it becuase of that ?



不,这是因为您在我的

分配中使用了LL 9876543219而不是9876543219LL。你的代码还有其他问题 - 特别是你的printf调用中long long int的

格式说明符不正确。


-

Richard Heathfield

Usenet是一个奇怪的地方 - dmr 29/7/1999
http://www.cpax.org.uk

电子邮件:rjh在上面的域名(但显然放弃了www)

No, it''s because you used LL 9876543219 instead of 9876543219LL in your
assignment to i. Your code also has other problems - particularly the
incorrect format specifier for long long int in your printf call.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)


Clark S. Cox III说:
Clark S. Cox III said:

这些错误消息(以及文件的.cpp后缀)向我建议

您将此代码编译为C ++,而不是C.
These error messages (and the ".cpp" suffix of your files) suggest to me
that you''re compiling this code as C++, not C.



啊,好点(我完全忽略了)。他想把它改成

a .c后缀,可以。


-

Richard Heathfield
Usenet是一个奇怪的地方 - dmr 29/7/1999
http://www.cpax.org.uk

电子邮件:rjh在上面的域名(但显然放弃了www)

Ah, nice spot (which I overlooked completely). He''ll want to change that to
a .c suffix, methinks.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)


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

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