请求成员不是结构或联盟 [英] request for member in something not a structure or union

查看:54
本文介绍了请求成员不是结构或联盟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨专家,


我在尝试访问

结构中的成员时遇到此编译错误。

我们什么时候会收到此错误消息?


谢谢,

迪帕克

Hi Experts,

I''m getting this compilation error while trying to access a member in
structure.
at what time we will get this error message?

Thanks,
Deepak

推荐答案

deepak写道:
deepak wrote:

嗨专家,


我在尝试时遇到此编译错误访问

结构中的成员。

我们什么时候会收到此错误消息?
Hi Experts,

I''m getting this compilation error while trying to access a member in
structure.
at what time we will get this error message?



当你使用箭头操作符( - >)时使用点运算符(。)



代替。


-

pete

When you use a dot operator (.)
when you should be using an arrow operator (->)
instead.

--
pete


5月8日,10: 12,deepak< deepakpj ... @ gmail.comwrote:
On 8 May, 10:12, deepak <deepakpj...@gmail.comwrote:

我在尝试访问
$中的成员时遇到此编译错误b $ b结构。

我们什么时候会收到此错误消息?
I''m getting this compilation error while trying to access a member in
structure.
at what time we will get this error message?



十三点


也许你发布的代码和错误信息

我们有更多机会诊断你的问题。


-

Nick Keighley

thirteen o''clock

perhaps if you posted the code and the error message
we would have more chance of diagnosing your problem.

--
Nick Keighley

deepak说:
deepak said:

嗨专家,


我在尝试访问时遇到此编译错误

结构中的成员。

我们什么时候会收到此错误消息?
Hi Experts,

I''m getting this compilation error while trying to access a member in
structure.
at what time we will get this error message?



当你有指向结构的指针时,你常常会看到类似的东西,

但是你假装它's struct。


time_t tt = time(NULL);

struct tm * ptr = localtime(& tt);


分钟= ptr.tm_min; / * error - ptr不是结构,而是指针* /


分钟= ptr-> tm_min; / *修复* /


当然,这只是一个猜测,确切的修复可能会有所不同,

取决于你的代码(我的我看不到。


-

Richard Heathfield< http://www.cpax.org.uk>

电子邮件:-http:// www。 + rjh @

谷歌用户:< http://www.cpax.org.uk/prg/writings/googly.php>

Usenet是一个奇怪的放置" - dmr 1999年7月29日

Often you''ll see something of the kind when you have a pointer to a struct,
but you''re pretending it''s a struct.

time_t tt = time(NULL);
struct tm *ptr = localtime(&tt);

Minute = ptr.tm_min; /* error - ptr is not a struct, but a pointer */

Minute = ptr->tm_min; /* a fix */

Of course, this is really just a guess, and the exact fix may differ,
depending on your code (which I can''t see).

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999


这篇关于请求成员不是结构或联盟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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