Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public
Document Table of Contents

fortlib

Tells the C/C++ compiler driver to link to the Fortran libraries. This option is primarily used by C/C++ for mixed-language programming.

Syntax

Linux:

-fortlib

Windows:

None

Arguments

None

Default

OFF

C/C++ compiler drivers do not link to Fortran libraries.

Description

This option tells the C/C++ compiler driver to link to the Fortran libraries. This option is primarily used by C/C++ for mixed-language programming.

It is useful for building mixed Fortran and C/C++ applications, and it is only effective at link time.

IDE Equivalent

None

Alternate Options

None

Example

Consider that a C/C++ program contains the following lines:

icx  mymain.c -c
…
ifx sub1.f90 -c
icx -fortlib mymain.o sub1.o

In this case, the C/C++ program will link to the Fortran libraries at link-time.