Re: undefined reference using netcdf library

Yair suari wrote:
i dont think its finding the library but when i look at the netcdf.a (using nm command) i can see the functions which could not be found. during my googling i found two things related to such problems one has something to do with added underscore to function names during compilation and the other with the -i switch but i could stil not solve the problem.
thanks alot for your help
yair

On 2/2/07, *Jeff Whitaker* <jswhit@xxxxxxxxxxx <mailto:jswhit@xxxxxxxxxxx>> wrote:

    Yair Suari wrote:
    > Jeff thanks for your help
    > I tried to link the compiler to the netcdf.mod file but it did
    not help
    > (before I had a link to that file in the compiling folder)
    > The massages I get are not from not seeing netcdf.mod
    > I did see people use the -I switch but did not understand where
    do they
    > point it to.
    > Thanks again
    > yair
    >
    > -----Original Message-----
    > From: Jeff Whitaker [mailto: jswhit@xxxxxxxxxxx
    <mailto:jswhit@xxxxxxxxxxx>]
    > Sent: Thursday, February 01, 2007 5:47 AM
    > To: Yair suari
    > Cc: netcdfgroup@xxxxxxxxxxxxxxxx
    <mailto:netcdfgroup@xxxxxxxxxxxxxxxx>
    > Subject: Re: undefined reference using netcdf library
    >
    > Yair suari wrote:
    >
    >> i an a new user to netcdf,unix,fortran so this will probably be
    easy
    >> to most of you but i cant get to start using the netcdf interface.
    >> when trying to compile i get the following massages:
    >>
    >> yair@yairsuari:~/fortran/cdfdata$ ifort create.f90 -g -o create.o
    >> /tmp/ifortmAdSAz.o: In function
    >> `cdfcreate':/home/yair/fortran/cdfdata/create.f90:5: undefined
    >> reference to `netcdf_mp_nf90_create_'
    >> /tmp/ifortmAdSAz.o: In function
    >> `handle_err':/home/yair/fortran/cdfdata/create.f90:12: undefined
    >> reference to `netcdf_mp_nf90_strerror_'
    >>
    >> i am using ubuntu (debian based linux) on x86 machine and intel
    >> fortran compiler 9.1
    >>
    >> when googling around for this i saw a similar problem created when
    >> using a different compiler for your programs and for the netcdf
    >> compilation but this is not the case, i have always used intel.
    >>
    >> please HELP
    >> yair
    >>
    >> --
    >> Yair Suari
    >> Hamafteach 23 Michmoret Israel 40297
    >> Phone-0528-524520, 09-8664245
    >>
    >
    > Yair:  You need to use pass ifort (or any fortran compiler) the
    location
    > of 'netcdf.mod', via '-I/path/to/module' and the library via
    > '-L/path/to/netcdf/library -lnetcdf'.
    >
    > -Jeff
    >
    >

    Yair:  What about the -L flag?  It must not be finding the library
    then.

    -Jeff


Yair: Are you telling the linker where to find the library? For example, if the lib is in /usr/local/lib, you need to use
'-L/usr/local/lib -lnetcdf' when linking.

-Jeff

--
Jeffrey S. Whitaker         Phone  : (303)497-6313
Meteorologist               FAX    : (303)497-6449
NOAA/OAR/PSD  R/PSD1        Email  : Jeffrey.S.Whitaker@xxxxxxxx
325 Broadway                Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web    : http://tinyurl.com/5telg

==============================================================================
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: