Before you can use the compiler, you must first set the environment variables by sourcing the environment script using the initialization utility. This initializes all the tools in one step.
The Intel® oneAPI DPC++/C++ Compiler provides multiple drivers:
Language | Linux Drivers | Windows Drivers | Option Style | Notes |
---|---|---|---|---|
C |
icx icx-cc |
icx-cc |
Linux-style |
icx is the recommended default C driver for Linux. If you use icx with a C++ source file, it is compiled as a C++ file. Use icx to link C object files. icx-cc is the Microsoft-compatible variant of icx. |
C++ |
icpx | icpx |
Linux-style |
icpx is the recommended default C++ driver for Linux. If you use icpx with a C source file, it is compiled as an C++ file. Use icpx to link C++ object files. |
C/C++ |
icx-cl |
icx icx-cl |
Windows-style |
icx is the recommended default driver for Windows. icx-cl is the Microsoft-compatible variant of icx. On Linux, icx-cl requires the Microsoft Visual Studio package. |
Invoke the compiler using the following syntax:
{compiler driver} [option] file1 [file2...]
For example:
icpx hello-world.cpp
For SYCL compilation, use the -fsycl option with the C++ driver:
icpx -fsycl hello-world.cpp
Follow these steps to invoke the compiler from within the Eclipse* CDT.
Install the Intel® Compiler Eclipse CDT plugin.
Build a new project or open an existing project.
Set build configurations.
Use the following steps to test your compiler installation and build a program.
#include <iostream> int main() { std::cout << “Hello, world!\n”; return 0; }
icpx hello-world.cpp -o hello-worldThe -o option specifies the file name for the generated output.
hello-worldWhich outputs:
Hello, world!
You can direct and control compilation with compiler options. For example, you can create the object file and output the final binary in two steps:
icpx hello-world.cpp -cThe -c option prevents linking at this step.
icpx hello-world.o -o hello-worldThe -o option specifies the generated executable file name.
Refer to Compiler Options for details about available options.