Skip to content

Compile a C++ program using icpc

icpc is an Intel C++ compiler. This page describes how to compile C++ code using icpc.

Procedure

1. Load the modules

Load a recent intel module:

module load intel/20.4

2. Write the C++ program

Create and write a C++ source file called hello_world.cpp:

nano hello_world.cpp

In nano, write the C++ program as such:

#include <iostream>

int main() 
{
  std::cout << "hello, world\n";
}

3. Compile the C++ program

After saving and closing nano, compile as such:

icpc hello_world.cpp 

4. Run the executable

Run the program:

./a.out 

Output:

hello, world