468,458 Members | 1,754 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,458 developers. It's quick & easy.

error: storage size of 'frm' isn't known

When I compile the code snipets below I'm producing the error: storage
size of 'frm' isn't known.

dll.h :
/*
* File: dll.cpp
* Defines the data link layer's interface.
*/

#ifndef __FRAME_
#define __FRAME_

typedef unsigned int frame_kind;
typedef unsigned int seq_nr;

struct {
frame_kind kind;
seq_nr seq;
seq_nr ack;
char data[100];
}; frame

#endif

dataLinkSend() :
void dataLinkSend(int sd, char* data, seq_nr last) {
struct frame frm;

frm.kind = data;
frm.seq = (last++)%3;
frm.ack = last;
frm.data = data;

if(send(sd, frm, sizeof(frm), 0) < 0) {
fprintf(stderr, "Couldn't send frm\n");
exit(1);
}
}

If you need the whole file that dataLinkSend() id in, let me know and I
can post it.

Jul 11 '06 #1
5 27893
wa****@gmail.com said:

<snip>
>
struct {
frame_kind kind;
seq_nr seq;
seq_nr ack;
char data[100];
}; frame
Shift the tag:

struct frame {
frame_kind kind;
seq_nr seq;
seq_nr ack;
char data[100];
};

--
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)
Jul 11 '06 #2
wa****@gmail.com schrieb:
When I compile the code snipets below I'm producing the error: storage
size of 'frm' isn't known.
Please provide a compiling minimal example inserted in your
message by copy and paste. Otherwise, important information
or the error itself may be missing or people may spot errors
that were not there in the original version.
>
<snip>
typedef unsigned int frame_kind;
typedef unsigned int seq_nr;

struct {
frame_kind kind;
seq_nr seq;
seq_nr ack;
char data[100];
}; frame
This must not compile.

You mean:
struct frame {
....
};

<snip>
>
dataLinkSend() :
void dataLinkSend(int sd, char* data, seq_nr last) {
struct frame frm;
As you did not really create the type "struct frame" above,
this type is not known, and so is its size...

<snip>
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Jul 11 '06 #3
I got it working now. Thanks everyone.

Tim

Michael Mair wrote:
wa****@gmail.com schrieb:
When I compile the code snipets below I'm producing the error: storage
size of 'frm' isn't known.

Please provide a compiling minimal example inserted in your
message by copy and paste. Otherwise, important information
or the error itself may be missing or people may spot errors
that were not there in the original version.
<snip>
typedef unsigned int frame_kind;
typedef unsigned int seq_nr;

struct {
frame_kind kind;
seq_nr seq;
seq_nr ack;
char data[100];
}; frame

This must not compile.

You mean:
struct frame {
....
};

<snip>

dataLinkSend() :
void dataLinkSend(int sd, char* data, seq_nr last) {
struct frame frm;

As you did not really create the type "struct frame" above,
this type is not known, and so is its size...

<snip>
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Jul 11 '06 #4
wa****@gmail.com wrote:
When I compile the code snipets below I'm producing the error: storage
size of 'frm' isn't known.

dll.h :
/*
* File: dll.cpp
* Defines the data link layer's interface.
*/

#ifndef __FRAME_
#define __FRAME_

typedef unsigned int frame_kind;
typedef unsigned int seq_nr;

struct {
frame_kind kind;
seq_nr seq;
seq_nr ack;
char data[100];
}; frame

#endif

dataLinkSend() :
void dataLinkSend(int sd, char* data, seq_nr last) {
struct frame frm;

frm.kind = data;
frm.seq = (last++)%3;
frm.ack = last;
frm.data = data;

if(send(sd, frm, sizeof(frm), 0) < 0) {
fprintf(stderr, "Couldn't send frm\n");
exit(1);
}
}

If you need the whole file that dataLinkSend() id in, let me know and I
can post it.
I suppose it could be more complex than this but..

struct {
frame_kind kind;
seq_nr seq;
seq_nr ack;
char data[100];
}; frame
^
...kills it for me. Should be..

struct {
frame_kind kind;
seq_nr seq;
seq_nr ack;
char data[100];
} frame;
^
--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Jul 12 '06 #5
Joe Wright wrote:
wa****@gmail.com wrote:
>When I compile the code snipets below I'm producing the error: storage
size of 'frm' isn't known.

dll.h :
/*
* File: dll.cpp
* Defines the data link layer's interface.
*/

#ifndef __FRAME_
#define __FRAME_

typedef unsigned int frame_kind;
typedef unsigned int seq_nr;

struct {
frame_kind kind;
seq_nr seq;
seq_nr ack;
char data[100];
}; frame

#endif

dataLinkSend() :
void dataLinkSend(int sd, char* data, seq_nr last) {
struct frame frm;

frm.kind = data;
frm.seq = (last++)%3;
frm.ack = last;
frm.data = data;

if(send(sd, frm, sizeof(frm), 0) < 0) {
fprintf(stderr, "Couldn't send frm\n");
exit(1);
}
}

If you need the whole file that dataLinkSend() id in, let me know and I
can post it.
I suppose it could be more complex than this but..

struct {
frame_kind kind;
seq_nr seq;
seq_nr ack;
char data[100];
}; frame
^
..kills it for me. Should be..

struct {
frame_kind kind;
seq_nr seq;
seq_nr ack;
char data[100];
} frame;
^

This was a mistake. I need more rest. Should be..

struct frame {
frame_kind kind;
seq_nr seq;
seq_nr ack;
char data[100];
};

I'll go lie down now. See y'all later.

--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Jul 12 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by DiskMan | last post: by
1 post views Thread by Madhusuthanan Seetharam | last post: by
2 posts views Thread by Gvs | last post: by
3 posts views Thread by =?Utf-8?B?R2Vvcmdl?= | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kmladenovski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.