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.

Linking probelm with gfortran 4.2 and netcdf-3.6.2

Dear all,
I'm new to netcdf and I'm trying to use it within the
pacakage Abinit. I have a gcc/gfortran 4.2 compiler
installed on a Windows XP PC with cygwin.
I configured netcdf with the commands:

CC=gcc-4.2 FC=gfc-4.2 CXX=g++-4.2 CPP=cpp-4.2
CPPFLAGS=-Df2cFortran ./configure
--prefix=/usr/local/src/abinit-5.3.4/lib/netcdf

where gfc-4.2 is a link to gfortran.exe and so on.
The library compiles nicely with no errors.
When I try to use it to link an excutable or to
execute the tests in nf_test I get a lot of undefined
reference errors (in the following I attach some
lines):

make  nf_test.exe tst_f77_v2.exe   ftest.exe
tst_f90.exe
make[1]: Entering directory
`/usr/local/src/abinit-5.3.4/lib/netcdf/netcdf-3.6.2/nf_test'
/bin/sh ../libtool --tag=F77 --mode=link gfc-4.2  
-I../libsrc -I../f90 -g -O2   -o nf_test.exe 
test_get.o test_put.o nf_error.o nf_test.o test_read.o
test_write.o util.o fortlib.o   ../libsrc/libnetcdf.la
libtool: link: gfc-4.2 -I../libsrc -I../f90 -g -O2 -o
nf_test.exe test_get.o test_put.o nf_error.o nf_test.o
test_read.o test_write.o util.o fortlib.o 
../libsrc/.libs/libnetcdf.a
test_get.o: In function `test_nf_get_att_double_':
/usr/local/src/abinit-5.3.4/lib/netcdf/netcdf-3.6.2/nf_test/test_get.F:5511:
undefined reference to `_nf_open_'
/usr/local/src/abinit-5.3.4/lib/netcdf/netcdf-3.6.2/nf_test/test_get.F:5521:
undefined reference to `_nf_get_att_double_'
/usr/local/src/abinit-5.3.4/lib/netcdf/netcdf-3.6.2/nf_test/test_get.F:5526:
undefined reference to `_nf_get_att_double_'
/usr/local/src/abinit-5.3.4/lib/netcdf/netcdf-3.6.2/nf_test/test_get.F:5529:
undefined reference to `_nf_get_att_double_'
/usr/local/src/abinit-5.3.4/lib/netcdf/netcdf-3.6.2/nf_test/test_get.F:5547:
undefined reference to `_nf_get_att_double_'
/usr/local/src/abinit-5.3.4/lib/netcdf/netcdf-3.6.2/nf_test/test_get.F:5594:
undefined reference to `_nf_close_'
test_get.o: In function `test_nf_get_att_real_':
/usr/local/src/abinit-5.3.4/lib/netcdf/netcdf-3.6.2/nf_test/test_get.F:5403:
undefined reference to `_nf_open_'
/usr/local/src/abinit-5.3.4/lib/netcdf/netcdf-3.6.2/nf_test/test_get.F:5413:
undefined reference to `_nf_get_att_real_'
/usr/local/src/abinit-5.3.4/lib/netcdf/netcdf-3.6.2/nf_test/test_get.F:5418:
undefined reference to `_nf_get_att_real_'
/usr/local/src/abinit-5.3.4/lib/netcdf/netcdf-3.6.2/nf_test/test_get.F:5421:
undefined reference to `_nf_get_att_real_'
/usr/local/src/abinit-5.3.4/lib/netcdf/netcdf-3.6.2/nf_test/test_get.F:5439:
undefined reference to `_nf_get_att_real_'
/usr/local/src/abinit-5.3.4/lib/netcdf/netcdf-3.6.2/nf_test/test_get.F:5486:
undefined reference to `_nf_close_'

The problem is strange becuse if I use nm to look for
the undefinded references I can find them in the
library: 

nm libsrc/.libs/libnetcdf.a | grep _nf_open_
00000740 T _nf_open__
         U _nf_open_

The problem appears also with gfortran 4.3 and also
changing the FCFLAGS (I tried -fno-second-underscore,
-ff2c) and removing the directive -Df2cFortran.

Can you help me to solve these errors?
Thanks a lot and best regards,
Mauro Sgroi.




      ___________________________________ 
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: 
http://it.docs.yahoo.com/nowyoucan.html

==============================================================================
To unsubscribe netcdfgroup, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
==============================================================================


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