Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

Error LNK2019: unresolved external symbol _Invert_LaplacianZBCS referenced in function _MAIN__ Main.obj

$
0
0

Hi,

I got this error when trying to call a C function in Fortran. The C prototype of the function is

                        void Invert_LaplacianZBCS(double *t,int nx,int ny);

I built an interface in my Fortran program

   INTERFACE
!   
      SUBROUTINE Invert_LaplacianZBCS(t, nx, ny) BIND(C, name='Invert_LaplacianZBCS')
!
         USE, INTRINSIC :: iso_c_binding, ONLY: c_int, c_ptr
!
         IMPLICIT NONE
!
         TYPE(c_ptr), VALUE :: t
!
         INTEGER(c_int) :: nx, ny         
!
      END SUBROUTINE Invert_LaplacianZBCS
!      
   END INTERFACE

Then I called the C function in the main program:

     USE, INTRINSIC :: iso_c_binding

      REAL(KIND=c_double), ALLOCATABLE, DIMENSION(:), TARGET    ::  x
!
      INTEGER(c_int)        ::  m

      CALL Invert_LaplacianZBCS(C_LOC(x), m, m)

x and m were used in previous calculations and I checked that both of them were valid before the execution of the call.

However, an error was still produced when I built the solutions and the buildlog says:

 

Deleting intermediate files and output files for project 'M639 HW4', configuration 'Debug|Win32'. Compiling with Intel(R) Visual Fortran Compiler XE 12.0.5.221 [IA-32]... ifort /nologo /debug:full /Od /warn:interfaces /module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc100.pdb" /traceback /check:bounds /libs:static /threads /dbglibs /c /Qvc10 /Qlocation,link,"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin""\\pe-file\grads\jie.he\My Documents\Fortran projects\M639 HW4\M639 HW4\Compressed_Row_Storage.f90" ifort /nologo /debug:full /Od /warn:interfaces /module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc100.pdb" /traceback /check:bounds /libs:static /threads /dbglibs /c /Qvc10 /Qlocation,link,"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin""\\pe-file\grads\jie.he\My Documents\Fortran projects\M639 HW4\M639 HW4\Iterative_Methods.f90" ifort /nologo /debug:full /Od /warn:interfaces /module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc100.pdb" /traceback /check:bounds /libs:static /threads /dbglibs /c /Qvc10 /Qlocation,link,"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\\bin""\\pe-file\grads\jie.he\My Documents\Fortran projects\M639 HW4\M639 HW4\Main.f90" Linking... Link /OUT:"Debug\M639 HW4.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"\\pe-file\grads\jie.he\My Documents\Fortran projects\M639 HW4\M639 HW4\Debug\M639 HW4.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"\\pe-file\grads\jie.he\My Documents\Fortran projects\M639 HW4\M639 HW4\Debug\M639 HW4.pdb" /SUBSYSTEM:CONSOLE /STACK:100000000 /IMPLIB:"\\pe-file\grads\jie.he\My Documents\Fortran projects\M639 HW4\M639 HW4\Debug\M639 HW4.lib""Debug\Compressed_Row_Storage.obj""Debug\Iterative_Methods.obj""Debug\Main.obj" Link: executing 'link' Main.obj : error LNK2019: unresolved external symbol _Invert_LaplacianZBCS referenced in function _MAIN__ Debug\M639 HW4.exe : fatal error LNK1120: 1 unresolved externals M639 HW4 - 2 error(s), 0 warning(s)

Does anyone know what is going wrong, please? I use Intel(R) Visual Fortran Compiler XE 12.0.5.221.

Thanks,


Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>