1
While trying to compile I am facing the following error:
..: error: storage size of 'PPFila' isn't known
..: error: storage size of 'AUTFila' isn't known
On this code line
struct Fila PPFila, AUTFila;
To struct
Queue this being in another file queue.c
and I’m accessing using #include "Queue.h"
Exactly, I must create the
strucs
and method statements in . h leaving only the implementations in . c, had not noticed this, thank you– Lucas Fernandes
@Lucasfernandes: That’s not true! The definition (implementation) of
structs
in the.h
makes its members accessible by the interface clients (public members), definitions made in the.c
(separate from the declaration) make the members of itsstruct
are inaccessible by the interface clients (private members). The second type is called "Opaque Structure".– Lacobus
@Lucasfernandes: https://en.wikipedia.org/wiki/Opaque_data_type
– Lacobus
@Lacobus does not confuse definition (implementation) with statement. What you said is not correct. Definition goes in . c and statement no . h A statement is when you present the name to the program and the definition is when you instantiate. When doing
struct File PPFila;
is a definition and usually goes in a . c– user5299
@Amadeus: I think you need to revise your concepts: http://stackoverflow.com/questions/1410563/what-is-the-difference-between-a-definition-and-a-declaration
– Lacobus
@Lacobus I don’t understand what you mean by your last comment. What’s on the link you provided is exactly what I commented on earlier. So, what concept should I review?
– user5299
@Amadeus: This is a statement:
struct foobar;
and that’s a definition:struct foobar { int x; };
. There are no rules saying in which files the definitions and statements should be made. The point here is that DEPENDING on the way thestruct
has been defined and declared the effect may vary, changing the visibility of thestruct
and/or its members to the interface client. The example you pointed out is an "opaque structure" that has its statement in the.h
and its definition in.c
, however, this is not a rule.– Lacobus