By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,889 Members | 1,373 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,889 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.