Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7944 Discussions

How to select the C++ Compiler Classic Version for one visual studio project?

Guillaume_A_
New Contributor I
3,016 Views

Hello,

 

There are two versions of the C++ Compiler Classic 19.2 installed in my system,  2021.1 and 2021.5. I am trying to define the version (2021.1 or 2021.5) to use for specifics Visual Studio projects (.vcxproj) or for a visual solution (.sln). 

I found this in the developer guide but it defines the version for all projects in my system (I mean: for the projects which use the Intel C++ Compiler 19.2 PlatformToolset)

 

Questions:

  1. Where in Windows OS is defined the C++ Compiler Classic version controlled by Visual  "Tools->Options->Intel Compilers and Libraries->Compilers" ?
  2. Is there a way to define the C++ Compiler Classic version only for specifics Visual projects (or solution)?
  3. Is there a way to define the C++ Compiler Classic version outside the Visual Studio GUI?

 

My need: 

My program uses the Intel C++ Compiler 19.2 PlatformToolset. It is compiled through MSBuild on servers. I want to install the last version of C++ Compiler Classic (2021.5) on the compilation servers for test purpose. But in the meanwhile the servers must be still able to compile with the old C++ Compiler Classic  (2021.1) without human intervention to switch the version into Visual Studio.

 

My config:

  • Intel oneAPI: 2021.1 and 2022.1
  • Visual Studio 2019 (16.10.0)
  • Windows 10 Enterprise x64

 

Thanks in advance for your help,

Guillaume A.

0 Kudos
1 Solution
VarshaS_Intel
Moderator
2,819 Views

Hi,

 

I apologize for the delay in my response.

 

Could you please try changing the settings in the MS Visual Studio Projects you required "Project Properties->Configuration Properties->VC++ Directories".

 

Please find the tick mark in the below screenshot where we need to change the path for the Intel oneAPI version.

VSSetting.png

After applying the settings, we have tried it on using MS Build and we are able to see two different versions of Intel oneAPI is being used as specified. Please find the below screenshot for more information.

MSBuild.png

Thanks & Regards,

Varsha

 

View solution in original post

0 Kudos
8 Replies
VarshaS_Intel
Moderator
2,984 Views

Hi,

 

Thanks for reaching out to us.

 

Yes, by using the setting(Tools->Options->Intel Compilers and Libraries-> C++ ->Compilers) in Microsoft Visual Studio, we are able to use the Intel oneAPI versions which we have downloaded previously.

 

-->Is there a way to define the C++ Compiler Classic version only for specifics Visual projects (or solution)?

We can define the C++ Compiler Classic version by using the above settings in Visual Studio. we can specify any previously downloaded version if needed. Please find the below screenshot for more information.

VS2021.3.png

By changing the setting manually in Visual Studio, we can be able to use the required version of Intel Classic Compiler 19.2.

 

-->Is there a way to define the C++ Compiler Classic version outside the Visual Studio GUI?

One way is to use the command prompt, you can able to set the specific version of the compiler as required. Please find the below command for it:

cd C:\Program Files (x86)\Intel\oneAPI\compiler\2021.3.0\env
vars.bat

For more details, please find the below screenshot:

ICL2021.3.png

 

Thanks & Regards,

Varsha

 

0 Kudos
Guillaume_A_
New Contributor I
2,967 Views

Hi Varsha, thanks for your answer.

 

The option "Tools->Options->Intel Compilers and Libraries-> C++ ->Compilers" defines the C++ Compiler Classic version for my whole system. That is what I am trying to avoid.

 

The script C:\Program Files (x86)\Intel\oneAPI\compiler\202x.x.x\env\vars.bat defines many things (included the path to icl.exe, indeed) for the running command prompt. It is useful if you want to call directly Intel compiler stuff. But it does not override what is defined by the option "Tools->Options->Intel Compilers and Libraries-> C++ ->Compilers" . Then if you compile a Visual project which uses the Intel C++ Compiler 19.2 PlatformToolset, MSBuild calls the compiler defined by "Tools->Options->Intel Compilers and Libraries-> C++ ->Compilers" and not the one define by C:\Program Files (x86)\Intel\oneAPI\compiler\202x.x.x\env\vars.bat. Even if you call MSBuild in the same command prompt. That is not what I want neither.

 

I am looking for a way to compile, through MSBuild and Intel C++ Compiler 19.2 PlatformToolset, in the same time and without Visual Studio GUI, ProjectA with icl.exe 2021.1 and ProjectB with icl.exe 2021.5.

 

Regards,

Guillaume A.

 

 

0 Kudos
VarshaS_Intel
Moderator
2,947 Views

Hi,

 

>>The option "Tools->Options->Intel Compilers and Libraries-> C++ ->Compilers" defines the C++ Compiler Classic version for my whole system.

No, actually this setting helps to use the required Intel C++ Classic Compiler(or other Intel compilers) only in the Visual Studio. But it doesn't affect the version of the command prompt.

 

Could you please try the below steps to run your project in different versions of Intel C++ Classic compilers:

 

Step 1: Open "Intel oneAPI command prompt for Intel 64 for Visual Studio 2019" it will automatically initialize the latest Intel oneAPI Environment. So, you can be able to run it for one project. Please find the below screenshot for more details:

latest2021.5.png

Step 2: Open the windows command prompt and there you can select the compiler version as per your requirement for the project by using the below command.

cd C:\Program Files (x86)\Intel\oneAPI\compiler\<required version>\env
vars.bat

Please find the below screenshots for more details:

commandprompt2021.4.png

By following these steps, you are able to run the projects on two different versions of Intel C++ Classic Compilers.

 

You can also take two different windows command prompt and by following step 2, you can use two different versions of Intel C++ Classic Compilers. Both the command prompts will use two different versions of Intel oneAPI.

commandprompt2021.5.png

Could you please try and let us know if this resolves your issue?

 

Thanks & Regards,

Varsha

 

0 Kudos
Guillaume_A_
New Contributor I
2,936 Views

>> Could you please try and let us know if this resolves your issue?

I guess there is a misunderstanding. Ok, my English is not perfect but seriously... it is quite clear: I am not calling directly icl on .cpp files, I am calling MSBuild on Visual projects that use Intel C++ Compiler 19.2 as PlatformToolset

 

Nevermind, let's try it:

0/ Extract of the .vcxproj:

Step_0.PNG

1/ Set the Intel C++ Classic Compiler version into Visual to 2021.5:

Step_1.PNG

2/ Compiling into Visual. Ok, it is fine:

Step_2.PNG

3/ Compiling into a command prompt. Ok; it is fine:

Step_3.PNG

4/ Go back to Visual and change the Intel C++ Classic Compiler version to 2021.1.1:

Step_4.PNG

5/ Compiling into Visual. Ok, it is fine:

Step_5.PNG

6/ Compiling into a command prompt. Ok; it is fine:

Step_5_bis.PNG

7/ Call C:\Program Files (x86)\Intel\oneAPI\compiler\2022.0.0\env\vars.bat and call icl.exe. Ok, it is the right version:

Step_6.PNG

8/ Call MSBuild. Not ok, it still using icl 2021.1.1:

Step_7.PNG

 

My need:

Here are two Visual projects in attachment (ConsoleApplication1.sln and ConsoleApplication2.sln). Both use the Intel C++ Compiler 19.2 as PlatformToolset. Is that possible to build those two projects (by calling MSBuild, without opening Visual) one with icl 2021.1.1 and the other with icl 2021.5?

I asked in my first post: Where in Windows OS is defined the C++ Compiler Classic version controlled by Visual  "Tools->Options->Intel Compilers and Libraries->Compilers" ? Having the possibility to change this setting without Visual Studio GUI could be fine.

 

Regards,

Guillaume A.

0 Kudos
VarshaS_Intel
Moderator
2,884 Views

Hi,

 

Thanks for providing all the detailed information.

 

We are working on your issue. We will get back to you soon.

 

Thanks & Regards,

Varsha

 

0 Kudos
VarshaS_Intel
Moderator
2,820 Views

Hi,

 

I apologize for the delay in my response.

 

Could you please try changing the settings in the MS Visual Studio Projects you required "Project Properties->Configuration Properties->VC++ Directories".

 

Please find the tick mark in the below screenshot where we need to change the path for the Intel oneAPI version.

VSSetting.png

After applying the settings, we have tried it on using MS Build and we are able to see two different versions of Intel oneAPI is being used as specified. Please find the below screenshot for more information.

MSBuild.png

Thanks & Regards,

Varsha

 

0 Kudos
Guillaume_A_
New Contributor I
2,784 Views

Hi,

This workaround is fine.

Thx,

Guillaume A.

0 Kudos
VarshaS_Intel
Moderator
2,780 Views

Hi,


>>This workaround is fine.

Glad to know your issue is resolved.


Thanks for accepting our solution. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


Thanks & Regards,

Varsha


0 Kudos
Reply