-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
Hi,
I have a source file called SourceA.c in which I have a structure definition and global structure object. I created a test file (test_SourceA.c) to test the SourceA.c and I have externed the global structure object but the compilation fails because the compiler cannot find the structure in the file which is understood. How are these issues generally tackled ? I know that I can simply move the structure definition to a .h file but I am just thinking if there is a better way as there is no need for the definition to be in the .h file.
SourceA.c is as shown below.
typedef struct
{
int A;
} structA;
StructA gtestSctruct;
void Func1()
{
gtestSctruct.A = 1;
}
test_SouceA.c is as shown below:
extern StructA gtestSctruct; //compilation error
Metadata
Metadata
Assignees
Labels
No labels