c programing with PGI Fortran

I have a mixed Fortran and C code. I have to add C to Fortran as a separate project and link it an external lib.
The system works fine when both are compiled as x64. But the C lib cannot be linked when I compile them with the Win32 option. An error "cannot open input file ‘…/ …/xxc.lib’. The compiling of the c lib with Win32 shows no error.

Hi Jia-olemiss,

It may be that the relative path used to locate xxc.lib for x64 is different than what is required to locate it for Win32. This is because Microsoft chose a different folder hierarchy for x64 output folders than it uses for Win32.

For example, a VC++ project called VCTest will have the following
directory structure by default:

   VCTest (.sln is here)
     Debug
     x64
       Debug
     VCTest (.vcxproj is here)
       Debug
       x64
         Debug

The Win32 build outputs are in the Debug directories; the x64 outputs
are in the x64/Debug directories.

Contrast this with how PVF lays out a project:

   PVFTest (.sln is here)
     PVFTest (.pvfproj is here)
       Win32
         Debug
       x64
         Debug
  • Mat

Hi Mat,

Two different paths were used for linking each of the lib files. The error
“LINK : fatal error LNK1181: cannot open input file '…/…” shows only for the Win32 lib.

Instead of using a relative path, try using the absolute path name to the library.

  • Mat

Mat,

The result also has error:
LINK : fatal error LNK1104: cannot open file '://C:\Users…