You have to declare the variable:
extern const double $(PRODUCT_NAME)VersionNumber
For a project Foo, this will be:
extern const double FooVersionNumber;
int main(int argc, char **argv) {
printf("product version: %f\n", FooVersionNumber);
return 0;
}
You can find the declared variables into derived sources. (in you project intermediates build files directory, search for "DerivedSources").
See man agvtool for more information
To enable Apple Generic Versioning, then, you must set up at least the VERSIONING_SYSTEM and CURRENT_PROJECT_VERSION project build settings for each project you want to be versioned.
The target of a versioned project will have two global variables generated and linked into your product. One is of type double and is simply the CURRENT_PROJECT_VERSION.
The other is a version string which is formatted to be compatible with what(1). These variables are available for use in your code.