Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [photran] using netcdf libraries

Hi, I am not an experienced netcdf user. However I found that I could install netcdf under cygwin setup.exe (search for netcdf). It will configure the netcdf with fortran compiler = gfortran. Then you just type the command: nc-config --all and you can see the options you need to add into your makefile.

hope this helps,

Xi

On Jul 29, 2011, at 2:34 AM, João Palma wrote:

Dear All,

 

(Before anything, great Eclipse, great Photran! – Thanks to all who make this possible!)

 

I program for some years now as a need, but I’m not a “real” programmer so,  sorry for some “less correct nomenclature”.

I’ve been trying for days to use NETCDF libraries with my Eclipse Helios and Photran 6 on Windows 7 (32Bit). And I couldn’t find a post on this. So here it goes:

 

Intro: NETDCF is a binary format and the name stands for NETwork Common Data Format and is widely use for scientific data transfer.

Info on NETCDF is available at http://www.unidata.ucar.edu/software/netcdf/

 

At this website they release binaries and source code to use.

At this stage I´m  trying to set up the use of the libraries with their own a sample fortran code:

Available here: http://www.oifii.org/ns-org/nsd/ar/netcdf-4.0/examples/F90/nc4_simple_xy_wr.f90

 

I downloaded the version 4.0 (binary-netcdf-4.0_gfortran_gfortran_c++.tar.gz - Binary distribution of netcdf-4.0 on linux_2.6-x86_64) here:

http://www.unidata.ucar.edu/downloads/netcdf/netcdf-4_0/index.jsp

 

I downloaded the linux version, as I assume cygwin will deal with it as it deals with the Photran…

 

this comes with a structure of 4 folders as:

bin

include

lib

share

 

which I added to a subfolder called netcdf40 of my Photran Project.

 

After reading the “Compiling and Linking with the NetCDF Library” intructions  (http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-f90/Compiling-and-Linking-with-the-NetCDF-Library.html#Compiling-and-Linking-with-the-NetCDF-Library )

 

I then went to my Photran project properties and added the include path and the lib path as

 

Fortran Build ->Directories -> Include paths: "${workspace_loc:/${ProjName}/netcdf40/include}"

GNU Fortran Linker ->Libraries -> Include paths: "${workspace_loc:/${ProjName}/netcdf40/lib}"

 
 

When compiling, it seems it grabs the include path, but it does not recognizes the functions/routines in the library. Here’s the compiling output:

 

**** Build of configuration Debug for project readNETCDF_test ****

 

make all

Building target: readNETCDF_test

Invoking: GNU Fortran Linker

gfortran -L"E:\Programming_tools\eclipse\readNETCDF_test\netcdf40\lib" -o"readNETCDF_test"  ./nc4_simple_xy_wr.o  

cygwin warning:

  MS-DOS style path detected: E:\Programming_tools\eclipse\readNETCDF_test\Debug

  Preferred POSIX equivalent is: /cygdrive/e/Programming_tools/eclipse/readNETCDF_test/Debug

  CYGWIN environment variable option "nodosfilewarning" turns off this warning.

  Consult the user's guide for more details about POSIX paths:

    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames

./nc4_simple_xy_wr.o: In function `nc4_simple_xy_wr':

/cygdrive/e/Programming_tools/eclipse/readNETCDF_test/Debug/../nc4_simple_xy_wr.f90:59: undefined reference to `___netcdf_MOD_nf90_create'

/cygdrive/e/Programming_tools/eclipse/readNETCDF_test/Debug/../nc4_simple_xy_wr.f90:62: undefined reference to `___netcdf_MOD_nf90_def_dim'

/cygdrive/e/Programming_tools/eclipse/readNETCDF_test/Debug/../nc4_simple_xy_wr.f90:63: undefined reference to `___netcdf_MOD_nf90_def_dim'

/cygdrive/e/Programming_tools/eclipse/readNETCDF_test/Debug/../nc4_simple_xy_wr.f90:72: undefined reference to `___netcdf_MOD_nf90_def_var_manydims'

/cygdrive/e/Programming_tools/eclipse/readNETCDF_test/Debug/../nc4_simple_xy_wr.f90:75: undefined reference to `___netcdf_MOD_nf90_enddef'

/cygdrive/e/Programming_tools/eclipse/readNETCDF_test/Debug/../nc4_simple_xy_wr.f90:80: undefined reference to `___netcdf_MOD_nf90_put_var_2d_fourbyteint'

/cygdrive/e/Programming_tools/eclipse/readNETCDF_test/Debug/../nc4_simple_xy_wr.f90:84: undefined reference to `___netcdf_MOD_nf90_close'

./nc4_simple_xy_wr.o: In function `check':

/cygdrive/e/Programming_tools/eclipse/readNETCDF_test/Debug/../nc4_simple_xy_wr.f90:93: undefined reference to `___netcdf_MOD_nf90_strerror'

collect2: ld returned 1 exit status

make: *** [readNETCDF_test] Error 1

 

I also tried other different ways to put the –L in the miscellaneous section (and removing from Libraries) but the problem persists.

 

What am I doing wrong?

Any help would be appreciated.

 

João Palma



--
FORCHANGE - Forest Ecosystems Management under Global Change,
Centro de Estudos Florestais,
Instituto Superior de Agronomia,
Tapada da Ajuda
1349-017 Lisboa
Portugal

Email: joaopalma@xxxxxxxxxx
Web:http://www.isa.utl.pt/~joaopalma
Tel.: +351 213 653 489
Fax.: +351 21 364 33 38



_______________________________________________
photran mailing list
photran@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/photran


Back to the top