Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29277 Discussions

Selecting the compiler version to use

netphilou31
New Contributor III
758 Views

Hi,

I am not sure to post the question in the best location, but since it's relating to the Fortran compiler, I thought it was the right place. 

My question is very basic, I frequently use different versions of the compiler installed on my computer and for some customers I need to use a specific one (generally the latest) while for other projects I am using a previous version. I know where to select which compiler I want to use but quite often I forget to switch it back to its original setting (after build) or to select the right one to use (before build). Generally, I quickly identify the issue, but this leads to the need of a complete rebuild with the correct version. So, I was wondering if there was an extension or a possibility to be able to select the version to use directly from a toolbar menu in Visual Studio. This will easily allow us to see which version is currently selected and to be able to switch it to another one (both 32-vit and 64-bit versions at the same time or based on the selected configuration Win32 / x64).

Best regards,

0 Kudos
4 Replies
DavidWhite
Valued Contributor II
720 Views

Under Tools / Options

DavidWhite_0-1733905356400.png

 

0 Kudos
netphilou31
New Contributor III
708 Views

Hi David,

Thanks for your reply, but I already knew that.

I just asked if there was a more convenient way (in a specific toolbar menu) to see which version is currently selected and to select another one.

Best regards,

0 Kudos
andrew_4619
Honored Contributor III
694 Views

There are predefinned macros e.g. see https://www.intel.com/content/www/us/en/docs/fortran-compiler/developer-guide-reference/2023-1/predefined-preprocessor-symbols.html

 

and say __INTEL_COMPILER maybe you can use a macro to compare actual to wanted and include as a prebuild step? I would need to make some reading to work out what is possible I am just punting my thoughts. 

 

for example the snip below will compile in a debug build but will throw errors if not, noy the best maybe but the basis for further thinking

 

    !DIR$ IF DEFINED (_DEBUG)
        retl4 = .true.
    !DIR$ ELSE
        retl4 = fff.false.  !garbage
    !DIR$ END IF

 

0 Kudos
netphilou31
New Contributor III
680 Views

Hi Andrew,

Thanks for posting your thoughts, maybe through a macro I could check which version of the compiler is currently selected, but it's been a couple of years that Microsoft has removed the macro feature from Visual Studio, and even in the Pre-Build Events (which I already use for updating some copyright info) I don't know how to test the compiler version to stop the build process if the version is not the one expected.

Best regards,

0 Kudos
Reply