Please help me fix the error ‘un defined reference to f – xargc’. Also the underscore problem is to be solved. How can I say the linker for ignoring the unresolved reference? The MKL with PGI compiler can be used and if can be used how can it be used?
Answered By
Lee Seen
0 points
N/A
#100507
How to fix the undefined reference errors
Â
The following are the solutions for the problem above:
Â
First, you can choose to add a C function that will be used to define and also assignsxarg & xargc and it will also add a call to the C function from the fortran main program. See example below:
Â
    zarg.c:
    int   xargc;
    char **xargv;
    extern int   __argc_save;
    extern char **__argv_save;
    void zarg_()Â
    {     Â
      /* call zarg() from fortran */
      xargc = __argc_save;
      xargv = __argv_save;
    }
The second workaround will be to recompile the file farg.f with 'pgf77 -c' and thereafter you will add the object to the link before -lmpich. In case the second underscore is needed especially for the global names, then you will need tor to include the second underscore option. Here is the source for farg.f:
Â
  integer function mpir_iargc()
   mpir_iargc = iargc()
   return
   end
   subroutine mpir_getarg( i, s )
   integer    i
   character*(*) s
   call getarg(i,s)
   return
   endÂ
Â
Lee Seen