Unresolved External Symbol Problem

I am using pgf77 on Windows Vista 32-bit, and when I try to compile and link 4 FORTRAN programs, the messages I get at the end are:

lssm2.obj : error LNK2019: unresolved external symbol _HLC@16 referenced in function _CONTOV@16
lsslib2.obj: error LNK2001: unresolved external symbol _HLC@16
lsslib2.obj: error LNK2019: unresolved external symbol _ECORE@12 referenced in function _UPDATE@0
lssm2.exe : fatal error LNK1120: 2 unresolved externals

I don’t know much about FORTRAN at all, and I am not knowledgeable in computer science in general. But, I know that this normally means that I have not linked all of the correct files, but this is not the case, because I compiled it successfully under my Linux OS with gfortran. Please let me know if you need any more information.

Hi Peter,

Please see the section titled “Win32 Calling Conventions” in chapter 11 of the PGI User’s Guide for details. Bascially we use the “DEC” style Fortran calling convention on Win32. So when linking your Fortran program with C functions, you either need to tell the compiler which functions are “C” via the “!DEC$ ATTRIBUTE C :: func_name” directives or use the flag “-Munix” to tell the compiler to use Unix calling conventions instead. If your program is self contained (i.e. it doesn’t call third party or system libraries from Fortran) then adding “-Munix” is the easiest option.

Hope this helps,
Mat

Wow, thank you very much for your help! Using the flag “-Munix” compiled the program without a problem. I never would have figured that out with my professor; thanks a lot!