Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Scott_S_2
Beginner
242 Views

C++17 features

Hi,

I've ran into some issues with my windows build and C++17 features, particularly for standard library includes.

for example in the Sepia-filter sample code I cannot use std::apply anywhere, since the function cannot be found. std::apply is a C++17 feature so I went to change the /std flag to c++17 but i cannot find the option for that in the visual studio solution.

In another another solution generated from cmake using SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17) or set(CMAKE_CXX_STANDARD 17) doesn't fix the issue either.

Looking into the headers it looks like #if _HAS_CXX17 is defined to zero, blocking out these features.
 

Regards
Scott

 

 

Tags (1)
0 Kudos
10 Replies
RahulV_intel
Moderator
242 Views

Hi Scott,

Follow these steps to change C++ standard in VS and let us know if it worked:

  • In the "solution explorer" window on your right, click on the project file and then press "alt+enter" simultaneously, which will open the properties window.
  • In the property pages window, click on the "General" tab under the "Configuration Properties" tab.
  • For the corresponding value of "C++ Language Standard", under the General Properties option, double click on the corresponding value to change C++ language standard to the standard of your choice.

After following these steps, try to build the project again and let us know if you are able to run C++17 constructs in your code.

 

--Rahul

Scott_S_2
Beginner
242 Views

Hi,

The "C++ Language Standard" doesn't appear to exist in the general properties page (see https://ibb.co/YLF3gsN)

In other projects that use the regular msvc compiler I've seen this (see https://ibb.co/MnHbwxP) but its different when you are using DPC++, where there is no language tab (see https://ibb.co/86S3Bzq)

 

- Scott

RahulV_intel
Moderator
242 Views

Hi,

Could you provide the VS version number and oneAPI base-toolkit version number that you've been using?

I could see the C++ language standard option on my VS 19 Professional(Version 16.5.3) with DPC++ environment(beta05).

Kindly update your oneAPI base-toolkit and VS to the latest build, if not done.

Follow this documentation to build/run sample applications: https://software.intel.com/en-us/get-started-with-intel-oneapi-base-windows-run-a-sample-project-usi...

 

--Rahul

.

Scott_S_2
Beginner
242 Views

Hi,

I'm using

Microsoft Visual Studio Pro 2017, Version 15.9.3
Intel(R) oneAPI Base Toolkit 2021.1-beta05

I'm not in a position to easily update my visual studio just yet, is there no other way of setting std:c++17?

- Scott

Scott_S_2
Beginner
242 Views

Hi,

I've managed to get an install of Visual Studio 2019 but this issue still occurs.  I can see the C++ Language Standard which I can now set to C++17, but I still get compiler errors.

For example placing

auto f = [](auto... a) {};
std::tuple<int, int> t;
std::apply(f, t);

in the first lines of main in the sepia-filter example code gives the following error:

1>src\\sepia_dpcpp.cpp(111,10): : error : no member named 'apply' in namespace 'std'
1>    std::apply(f, t);
1>    ~~~~~^
1>1 error generated.

I can Go To Definition to the file <tuple> where this function is defined, and the _HAS_CXX17 define seems to be 1, but the dpc++ compiler doesn't seem to see it that way...

- Scott

RahulV_intel
Moderator
242 Views

Hi Scott,

Initially, I was facing this issue too. I had assumed that my environment got messed up. Thanks for trying it out and letting us know. The error is reproducible at our end too.

We will inform this to the concerned team, in order to get it fixed.

Meanwhile, you can try building your code on command line(supports c++17 constructs. I've verified it).

Follow these steps to build your program on cmd line:

  • C:\Program Files (x86)\inteloneapi\setvars.bat 
  • dpcpp path_to_file\filename.cpp -std=c++17
  • a.exe

Invoke the -std=c++17 flag to enable C++17 features. Let us know if you face any issues while following these steps.

 

--Rahul

Scott_S_2
Beginner
242 Views

Hi,

Good to hear you can reproduce.  The cmd line works for me too.

Thanks

-Scott

PrasanthD_intel
Moderator
70 Views

Hi Scott,


Thanks for your patience. The issue raised by you has been fixed in the latest version 2021.2. Please download and let us know your experience with it.


PrasanthD_intel
Moderator
50 Views

Hi Scott,

 

We haven't heard back from you. Please let us know your feedback after testing the latest version.

 

Regards

Prasanth

PrasanthD_intel
Moderator
39 Views

Hi Scott,


We are closing this thread as the issue has been resolved in the latest version.

We will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only


Regards

Prasanth


Reply