Forrest logo
back to the mpicc tool

mpicc:tldr:689bd

mpicc: Compile a source code file into an object file.
$ mpicc -c ${filename-c}
try on your machine

This command is using the mpicc compiler to compile a single C source file and generate an object file. Here is the breakdown of the command:

  • mpicc: This is the command to invoke the MPI C compiler. MPI (Message Passing Interface) is a standard for writing parallel programs. The mpicc command is used to compile and link MPI programs.

  • -c: This is a compiler flag that indicates that the compilation process should stop after the object file is generated. It tells the compiler to omit the linking step, which creates the final executable, and only generate the object file.

  • ${filename-c}: This is a placeholder that should be replaced with the actual filename of the C source file you want to compile. The ${} syntax suggests that this is a variable, and filename-c is the variable name. The value of this variable is expected to be the filename of the C source file without the file extension.

To use this command, you need to replace ${filename-c} with the name of your C source file (excluding the .c file extension). For example, if your C source file is named program.c, the command would be:

mpicc -c program

After running this command, the compiler will generate an object file named program.o. This object file can be later used for linking with other object files to create the final executable.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the mpicc tool