With Apple Generic Versioning enabled, Xcode autogenerates a MyFramework_vers.c
file in the DERIVED_SOURCES_DIR
, which contains the version string and number defined as const unsigned char[]
and const double
.
However, with -Wmissing-variable-declarations
enabled (part of -Weverything
), this produces the warnings
no previous extern declaration for non-static variable 'MyFrameworkVersionString'
no previous extern declaration for non-static variable 'MyFrameworkVersionNumber'
It seems the possible solutions are:
- add
-Wno-missing-variable-declarations
to the cflags for this file - add
extern
declarations above the variable definitions - add a
#import
that pulls in theextern
declarations from the umbrella header
But I can't figure out how to do any of these since the file lives in DerivedSources and isn't a member of the Compile Sources phase. What am I missing?
(I found the VERSION_INFO_EXPORT_DECL
setting which would allow me to mark the variables extern
, but then I get the "extern variable has an initializer" warning, from -Wextern-initializer
, so that doesn't help.)