NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

[netcdfgroup] linking netCDF library with program written in Fortran

Dear all,

I have installed the following libraries on my MacBook Pro (OS X 10.8.2) using 
MacPorts:

- netcdf @4.2.1.1
- netcdf-cxx @4.2
- netcdf-fortran @4.2

I need to pass the information about the netcdf interface to JULES program 
written in Fortran and in the user manual the following option is suggested:

make COMPILER=gfortran BUILD=run CDF_LIB_PATH=/opt/local/lib \
CDF_MOD_PATH=/opt/local/include

The values for these options are the directories in which the pre-compiled 
netCDF library (libnc.a) and Fortran 90 module files (those with .mod 
extension) are located respectively. However, in my lib directory I don't have 
libnc.a library, only libnetcdf_c++.a and libnetcdf.a libraries. In my include 
directory I have NETCDF.mod and TYPESIZES.mod files. Now, when I run the above 
given command in my Terminal, I get the following error:

….
….
gfortran -c -fbounds-check rwerr_mod.f90 -J/Users/Nana/JULES/jules_v2.2/MODS 
-I/Users/Nana/JULES/jules_v2.2/MODS -I/Users/Nana/netcdf/include 
-I/Users/Nana/JULES/jules_v2.2/UTILS/drhook_dummy
Fatal Error: Reading module netcdf at line 25 column 2: Expected string
make[1]: *** [/Users/Nana/JULES/jules_v2.2/libjules.a(rwerr_mod.o)] Error 1
make: *** [make_SOURCE/MODULES/CONTROL] Error 2

When I run nc-config --flibs, I get the following information:

-L/opt/local/lib -lnetcdff -L/opt/local/lib -lnetcdf -lnetcdf

and for nc-config --includedir

/opt/local/include

Do you have an idea what I could do to fix this? Any help would be hugely 
appreciated.

Kind regards
Ana

------------------------
Ana Mijic
Dipl.Ing., MSc, DIC

Research Assistant
Department of Civil and Environmental Engineering

Skempton Building
South Kensington Campus
Imperial College London
London SW7 2AZ
Tel: + 44 (0) 20 7594 6115




  • 2012 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: