I have two files, first_pass.c
that includes mystring.h
that describes mystring.c
. While testing first_pass.c
I did the following includes
#include "../src/mystring.c"
#include "../src/first_pass.c"
#include <gtest/gtest.h>
Everything worked well, until I had to define a structure in mystring.h
. Simple as that
typedef struct Split {
char *head;
char *tail;
}Split;
And then I started to fail while compiling on error: ‘Split’ has a previous declaration as ‘typedef struct Split Split’
The requirements for the course are using C (not C++) and MAKE, so other testing frameworks, like Check were deprecated. I understand that it defines twice the struct, first time when it loads mystring.c
and another on first_pass.c
. What can I do about it?