Undefined reference problems are occurring

Asked By 20 points N/A Posted on -
qa-featured

Please help me to fix the error ‘un defined reference to f – xargc’. Also the underscore problem is to be solved.

How can I tell the linker to ignore the unresolved reference?

The MKL with PGI compiler can be used and if can be used how can it be used?

SHARE
Answered By 20 points N/A #100996

Undefined reference problems are occurring

qa-featured

Hi Landon,

What you may want to do is to add a C function on your code which will define and assign xarg and xargc. You would also need to add a call to the C function. It may look like the 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;

        }

Another step you may want to try is to recompile the file farg.f with ‘pgf77 –c’ and make sure to add the object to the link before –lmpich. You may need to add a second underscore to your code. See below:

integer function mpir_iargc()
      mpir_iargc = iargc()
      return
      end
      subroutine mpir_getarg( i, s )
      integer       i
      character*(*) s
      call getarg(i,s)
      return
      end 

Aristono

Related Questions