Re: [netcdfgroup] Building netcdf-fortran on Windows

  • To: Aristotelis Liakatas <agliak@xxxxxxxxx>
  • Subject: Re: [netcdfgroup] Building netcdf-fortran on Windows
  • From: Dave Allured - NOAA Affiliate <dave.allured@xxxxxxxx>
  • Date: Wed, 19 Aug 2020 14:51:00 -0600
Aristotelis,

The line "use netcdf" is required at the top of every fortran procedure
that calls any of the nf90_ procedures (unless inheritance is in play).
Your particular error message suggests that this line is missing.

On many systems, a special prefix is added to all symbol names defined in
fortran modules.  The purpose is to isolate module name spaces.  I am not
familiar with windows, but I expect something similar is done there.  You
should be able to see this with an appropriate symbol tool.  For example,
gfortran on Mac OS does this:

   /opt/local/lib 7> nm libnetcdff.6.dylib | grep nf90_open
   000000000004dd48 T ___netcdf_MOD_nf90_open
   000000000004e00c T ___netcdf_MOD_nf90_open_mp
   000000000000f3f7 T ___netcdf_MOD_nf90_open_par

... And under the hood, valid compiled user programs link with these
decorated symbols, not with plain nf90_ symbols.  HTH.


On Wed, Aug 19, 2020 at 10:54 AM Aristotelis Liakatas <agliak@xxxxxxxxx>
wrote:

> Hello,
>
> I am trying to build the static library for netcdf-Fortran on Windows 10
> using VS2019 and Intel Fortran compiler.
>
> I have downloaded the source code for version 4.5.2 and using cmake to
> generate the VS-related files. Also, I am linking against netcdf-c 4.7.3
> for which I am using the pre-built binaries (installed on my machine).
>
> Everything seems fine when building the static library and the
> netcdff.lib is being generated without issues. However, having a peek
> inside, there are no symbols for the nf90_* procedures. This is confirmed
> when trying to use this library in one of my projects (linking errors:
> unresolved external symbol nf90_*...).
>
> Any guidance would be appreciated!
>
> Aristotelis
>
  • 2020 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: