Hi, > I have just installed netcdf successfully. Now I am trying to compile > the simple_xy_wr.f90, I am getting some problems. I am using following > command to compile the program: > > gfortran -L/home/libs/lib -lnetcdf -L/home/libs/lib -lhdf5_hl -lhdf5 > -L/home/libs/lib -lz -lm -I/home/libs/include simple_xy_wr.f90 > > this gives following errors: > > /tmp/ccdPaqW7.o:simple_xy_wr.f90:(.text+0xe5): undefined reference to > `___netcdf > _MOD_nf90_create' > /tmp/ccdPaqW7.o:simple_xy_wr.f90:(.text+0x11d): undefined reference to > `___netcd > f_MOD_nf90_def_dim' > /tmp/ccdPaqW7.o:simple_xy_wr.f90:(.text+0x155): undefined reference to > `___netcd > f_MOD_nf90_def_dim' > /tmp/ccdPaqW7.o:simple_xy_wr.f90:(.text+0x277): undefined reference to > `___netcd > f_MOD_nf90_def_var_manydims' > /tmp/ccdPaqW7.o:simple_xy_wr.f90:(.text+0x2b0): undefined reference to > `___netcd > f_MOD_nf90_enddef' > /tmp/ccdPaqW7.o:simple_xy_wr.f90:(.text+0x356): undefined reference to > `___netcd > f_MOD_nf90_put_var_2d_fourbyteint' > /tmp/ccdPaqW7.o:simple_xy_wr.f90:(.text+0x36f): undefined reference to > `___netcd > f_MOD_nf90_close' > /tmp/ccdPaqW7.o:simple_xy_wr.f90:(.text+0x447): undefined reference to > `___netcd > f_MOD_nf90_strerror' > collect2: ld returned 1 exit status I think you only need to reorder the arguments to gfortran so that the the source file name comes before all the libraries, as in: gfortran -I/home/libs/include simple_xy_wr.f90 -L/home/libs/lib -lnetcdf -L/home/libs/lib -lhdf5_hl -lhdf5 -L/home/libs/lib -lz -lm --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: TMW-190074 Department: Support netCDF Priority: Normal Status: Closed
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.