About link with pgf77

I did my project under Linux Redhat 9.0 with gcc and pgf77.
As I know, when I did a executable file project include cpp files and fortran files, I’d better to link all of the obj files with pgf77 at last, or else I will meet some errors. But if I want to get a *.a file or *.so file, should I link all of the *.o files with pgf77?

Hi HuPo,

Most likely the errors you’re seeing when linking with gcc are undefined reference errors. This is because you need to add the PGI Fortran runtime libraries to your link. As you have observed, it easier to use pgf77 to link since these library are included by default.

To create static libraries, you would use ‘ar’ so neither compiler is involved. However, when you link the final application with this library, you will need to add the PGI runtime libraries.

To create dynamic libraries, you should again use pgf77 to ensure the Fortran runtime libraries as used. Again though, the final application will need to be linked with the PGI Fortran libraries.

  • Mat