To compile with g77 including NAG subroutines, it is necessary to give the path to the NAG library as follows: g77 driver.f [INSTALL_DIR]/lib/libnag_acml.a [INSTALL_DIR]/acml/libacml.a In our case NAG is in the linux system so they should be available to under /opt/NAG the full command is: g77 STR.f /opt/NAG/fll3a21dgl/lib/libnag_acml.a /opt/NAG/fll3a21dgl/acml/libacml .a (to compile to a.out)