Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting FILEVERSION from Visual C++ Resource File

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.

like image 258
known Avatar asked Oct 02 '09 01:10

known


1 Answers

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;
like image 87
Michael Avatar answered Sep 20 '22 14:09

Michael