compilation - Compiling Fortran netCDF programs with all available libraries -


first of i've read topic can't compile code. compiling fortran netcdf programs on ubuntu

i on ubuntu 14.04 , compiling fortran program uses netcdf. have compilation error this:

terrain.f:(.text+0x17efd): undefined reference 'ncopn_' terrain.f:(.text+0x18111): undefined reference 'ncopn_' terrain.f:(.text+0x187cc): undefined reference 'ncclos_' terrain.f:(.text+0x187ea): undefined reference 'ncclos_' 

definitely says have not netcdf fortran librarries. installed zlib, hdf5, netcdf c , netcdf fortran according these web pages disable shared , disable dap options.

http://www.unidata.ucar.edu/software/netcdf/docs/build_default.html http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-fortran-install.html

this result of nc-config --libs command:

-l/usr/local/lib -l/usr/local -lnetcdf -lhdf5_hl -lhdf5 -ldl -lm -lz 

this result of nf-config --flibs command:

-l/usr/local/lib -lnetcdff -l/usr/local/lib -lnetcdf -lnetcdf -lhdf5_hl -lhdf5 -lz 

i build project command:

gfortran terrain.f -i/usr/local/include -l/usr/local/lib -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz -lm -ldl 

what's wrong this?

edit: use --disable-netcdf-4 option in configuring netcdf c , netcdf fortran , can compile code. it's problem hdf5.

this isn't answer, need produce more info. write bare-bones program, , show code. show command use try , compile.

here 2 examples:

fortran 77:

$ cat test_nc.f        program test_nc       implicit none       include 'netcdf.inc'       integer ncid, nc_err        nc_err = nf_open('test.nc', nf_nowrite, ncid)       nc_err = nf_close(ncid)       end program test_nc  $ gfortran test_nc.f -o test_nc `nf-config --fflags --flibs` 

fortran 90:

$ cat test_nc.f90 program test_nc     use netcdf     implicit none     integer :: ncid, nc_err      nc_err = nf90_open('test.nc', nf90_nowrite, ncid)     nc_err = nf90_close(ncid) end program test_nc  $ gfortran test_nc.f90 -o test_nc `nf-config --fflags --flibs` 

both of these compile on system without errors or warnings.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -