473,398 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

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 28845
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: DiskMan | last post by:
System: Redhat 7.2 Kernel-2.6.11.8 GCC-3.4.3 CCC-6.5.9 Binutils-2.15 Make-3.80 GTK/GLIB-2.6.7 For some reason my Linux box is suddenly having issues trying to read ;
5
by: lottaviano | last post by:
I am using Access 2002 and have two tables (Main and Actions) linked (in Relationships) on one field "CAL_ID" (primary key in Main Table). Main Table is a list of equipment. Actions Table lists...
1
by: Madhusuthanan Seetharam | last post by:
Hi all, I'm a newbie to C. What does the error message "storage size of 'xxxxx' isn't known mean? TIA, - Madhu
2
by: Gvs | last post by:
Hi, I'm trying to compile an example semaphore .c file taken straight from the internet, but it won't compile with the error; gcc seminit.c -o seminit seminit.c: In function `main':...
11
by: John Friedland | last post by:
My problem: I need to call (from C code) an arbitrary C library function, but I don't know until runtime what the function name is, how many parameters are required, and what the parameters are. I...
3
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, I get a strange compile error when compile such simple program. Any ideas? foo.c: In function `main': foo.c:5: error: storage size of 'var' isn't known foo.c
3
by: mariab | last post by:
hi, i'm having the problem with my first socket program...i have been staring at it for an hour but i cant find whats wrong with it...can u check it out pls? #include <stdio.h> #include...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.