[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Re: Problem with structure (Daniel O'Connor)

From: wbounce
Subject: [avr-gcc-list] Re: Problem with structure (Daniel O'Connor)
Date: Tue, 4 Oct 2005 21:07:46 -0400

avr-gcc (GCC) 3.4.1
I must be using an old version 
avr-gcc (GCC) 3.4.1

I can not find #include <sys/types.h>
This is the command line I am using

avr-gcc -c -mmcu=atmega128 -I. -gdwarf-2   -O0 -funsigned-char
-funsigned-bitfields -fpack-struct -fshort-enums -Wall
-Wstrict-prototypes -Wa,-adhlns=DoSonar.lst  -std=gnu99
-Wp,-M,-MP,-MT,DoSonar.o,-MF,.dep/DoSonar.o.d DoSonar.c -o DoSonar.o 

And yes the only errors I get are referencing the 3 members of the

Message: 11
Date: Mon, 3 Oct 2005 14:30:01 +0930
From: "Daniel O'Connor" <address@hidden>
Subject: Re: [avr-gcc-list] Problem with structure
To: address@hidden
Cc: wbounce <address@hidden>
Message-ID: <address@hidden>
Content-Type: text/plain; charset="iso-8859-1"

On Monday 03 October 2005 11:59, wbounce wrote:
> I get this error
> DoSonar.c:110: error: request for member `Front' in something not a 
> structure or union
> On this line.
> Sonar[SonarIndex].Front = SonarRange;
> What am I doing wrong?

Have you tried building with -Wall?
Is this your only error message?

I just tried it and it works for me..
#include <sys/types.h>

typedef struct ranges_t {
    uint16_t          Front;
    uint16_t          Left;
    uint16_t          Right;

main(int argc, char **argv) {
    RANGES Sonar[2];

    Sonar[0].Front = 1;

Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :


AVR-GCC-list mailing list

End of AVR-GCC-list Digest, Vol 9, Issue 2

reply via email to

[Prev in Thread] Current Thread [Next in Thread]