Are there some preprocessor keywords to use to access the FILEVERSION defined in my .rc file at compile time?
I don't really want to add extra code to read the file information from the compiled product itself.
The preprocessor runs on the .RC file as well. Define the shared data in a header that is included by both the .RC and your source code.
i.e., in foo.h:
#define MY_PRODUCT_NAME Foo
Then in the foo.rc:
#include "foo.h"
VS_VERSION_INFO VERSIONINFO
// Many lines omitted
VALUE "ProductName", MY_PRODUCT_NAME
Then in foo.cpp:
#include "foo.h"
cout << MY_PRODUCT_NAME;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With