This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Hi Nancy, > I am trying to install netcdf on a MacBook Pro OS 10.5.8, and I'm using > g95 in bash shell. > > I saw this communication from another user: > http://www.unidata.ucar.edu/support/help/MailArchives/netcdf/msg09417.html > > I did the configuration and install like this person did. However, > when I try to compile a fortran file that has 'include netcdf.inc', with > this command: > > g95 -fno-second-underscore -O2 -fendian=big -cpp myprog.f > -I/usr/local/netcdf-4.1.1/include -L/usr/local/> netcdf-4.1.1/lib -lnetcdf > -L/usr/lib -lm > > I get these errors: > "_nf_get_vars_int_", referenced from: > _U54.575 in ccG067tQ.o > _U184.881 in ccG067tQ.o > _U413.1677 in ccG067tQ.o > "_nf_rename_att_", referenced from: > _U120.707 in ccG067tQ.o > _U249.1013 in ccG067tQ.o > _U482.1815 in ccG067tQ.o > "_nf_get_var1_int_", referenced from: > _U27.521 in ccG067tQ.o > _U160.832 in ccG067tQ.o > _U395.1641 in ccG067tQ.o > "_nf_create_", referenced from: > _U17.501 in ccG067tQ.o > _U146.803 in ccG067tQ.o > _U386.1623 in ccG067tQ.o > (...and lots more of the same...) > ld: symbol(s) not found > > Any suggestions? Yes, I don't think you need -fno-second-underscore or -fendian=big or -cpp. You installed netcdf-4.11, say "/usr/local". Then you have some utility programs in the "/usr/local/bin" directory, such as ncdump, ncgen, and nc-config. The nc-config utility will help with linking. First run "nc-config --all", and you will see something like: $ /usr/local/bin/nc-config --all This netCDF 4.1.1 has been built with the following features: --cc -> cc --cflags -> -I/usr/local/include --libs -> -L/usr/local/lib -lnetcdf -lcurl --cxx -> c++ --has-c++ -> yes --fc -> g95 --fflags -> -g -O2 -I/usr/local/include --flibs -> -L/usr/local/lib -lnetcdf -lcurl --has-f77 -> yes --has-f90 -> yes --has-dap -> yes --has-nc2 -> yes --has-nc4 -> no --has-hdf5 -> no --has-hdf4 -> no --has-szlib -> no --prefix -> /usr/local --includedir-> /usr/local/include --version -> netCDF 4.1.1 You want to use the values for --fflags and --flibs (that you could also get by just running "nc-config --fflags --flibs") when you compile myprog.f. For example, with the above output, I would use: $ g95 -g -O2 -I/usr/local/include myprog.f -L/usr/local/lib -lnetcdf -lcurl -o myprog and "myprog" would be the resulting executable program. Another way to do this without the cutting and pasting would be to use the nc-config utility directly in the compile command, such as: $ g95 `nc-config --fflags` myprog.f `nc-config -fflibs` -o myprog --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: UAA-157619 Department: Support netCDF Priority: Normal Status: Closed