Search code examples
c++c++17dpc++intel-oneapi

How can I specify C++ standard version in DPC++ compiler options?


I stumbled upon free stuff in the form of Intel oneAPI toolkit and everything works great, the samples compile fine but I don't know how to specify the C++ standard in the compiler options. From what I understand DPC++ is built on top of Clang so I should be able to choose which C++ version it compiles for but I don't know how.

How do I get my C++17 code to work?


Solution

  • This is an ongoing issue, there are reports of other users with the same issue. As far as I know it hasn't been solved yet, what you can do meanwhile is to run the program from the command line:

    1. Go to the folder where you installed OneApi, let's say C:\Program Files (x86)\inteloneapi\ and run setvars.bat to set environment variables.

    2. Then compile the program using the C++17 flag, navigate to the folder where the source code is and run dpcpp filename(s).cpp -std=c++17.