Search code examples
fortrangfortran

C_INCLUDE_PATH equivalent for Fortran?


Is there a Fortran equivalent to the standard environment variables C_INCLUDE_PATH and CPLUS_INCLUDE_PATH?


Solution

  • gfortran does not use an environment variable to modify the search path for modules.

    Much as C_INCLUDE_PATH and CPLUS_INCLUDE_PATH affect the preprocessor's search path, CPATH (and C_INCLUDE_PATH) can be used when invoking the preprocessor with gfortran. However, the use statement and include line are not part of the preprocessing stage: these variables will allow files to be found with #include but not otherwise.

    The Fortran language more widely does not specify such things. Other compilers beyond the tagged gfortran may use an environment variable of some name in the desired way.