Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

Compiler version number accessable from source code?

Smith__Neill
Beginner
653 Views
I would like to have the compiler's version number automatically placed into a string within my source code at compile time so that output files can include the compiler's version number along with the program's version number and build date. I currently set this information manually, but I would like it to be automatic just as various pieces of program version information are kept updated in special strings by my source version control software.

I know that the compiler option /Qsox places compiler info into a string in the executable file that one can search for in the *.exe file, but I want the information to be available during program execution. Is there any way to do this? Thanks.

Neill
0 Kudos
3 Replies
Steven_L_Intel1
Employee
653 Views
The predefined preprocessor symbol __INTEL_COMPILER has the version number in the form of an integer, such as 1200 for 12.0, but it doesn't reflect individual updates. __INTEL_COMPILER_BUILD_DATE gives you a value such as 20101006 that is the build date in YYYYMMDD format. Unfortunately, it seems difficult to put these into constant strings - at least my attempts to do so have failed. But you can put them into PARAMETER constants such as:

INTEGER, PARAMETER :: INTEL_COMPILER_VERSION = __INTEL_COMPILER
INTEGER, PARAMETER :: INTEL_COMPILER_BUILD_DATE = __INTEL_COMPILER_BUILD_DATE

You can then write these values in whatever format you want. You must enable "Preprocessing" to get these to work.
0 Kudos
Smith__Neill
Beginner
653 Views
Thanks Steve,

An INTEGER PARAMETER works just fine. When you say "Preprocessing" must be enable, do you mean setting "Preprocess Source File" to Yes(/fpp) under the IDE Property Pages Fortran:Preprocessor? Do any of the other items on this Property Page need to be set?

Where is there help on the preprocessing options and the predefined preprocessor symbols? I did a search under Help for _INTEL_COMPILER and got no results.

Thanks again.

Neill
0 Kudos
Steven_L_Intel1
Employee
653 Views
Yes, that's all you need to set. For more info, see the on-disk doc under Building Applications > Preprocessing > Using the predefined preprocessor symbols
0 Kudos
Reply