I have a header file, let's call it foo.h. Inside of foo.h, I have the following code.
extern const size_t video_column_size;
In another file, let's call it first.c, I have the following code.
#include "foo.h"
video_column_size = 4;
My goal is for this value to be a single constant variable that will be shared across all classes that include the foo.h header.
When I compile and link, I get the following errors.
warning: data definition has no type or storage class
warning: type defaults to 'int' in declaration of 'video_column_size' [-Wimplicit-int]
conflicting type qualifiers for 'video_column_size'
note: previous declaration of 'video_column_size' was here:
extern const size_t video_column_size;
From what I understand, the reason this is happening is because C defaults to the int type when there is no type declaration. However, I assumed that the definition of the variable would carried over from the header file. Where am I going wrong?