Re: ncl api library

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Sun Sep 05 2010 - 15:11:27 MDT

Hi Linjun,

The undefined references you are seeing here are from the HLU (high
level) graphics library, which is required in addition to the nclapi
library. However, there are a number of other libraries you will need
as well. Exactly which libraries will depend on which version of NCL
you have installed. You can get a basic idea by generating one of the
HLU C examples, for instance, by running this command:

ng4ex cn01c

For me, this generates the following compile line (on a Mac):

gcc -DSYSV -D_POSIX_SOURCE -D_XOPEN_SOURCE -DByteSwapped -D__UNIXOS2__
-DNeedFuncProto -ansi -fPIC -g -o cn01c cn01c.c -L/usr/local/ncarg/lib
-L/usr/local/lib -L/usr/X11R6/lib -L/sw/lib -I/usr/local/ncarg/include
-I/usr/local/include -I/usr/local/include/cairo -I/usr/local/include/
freetype2 -I/usr/X11R6/include -lhlu -lncarg -lncarg_gks -lncarg_c -
lXpm -lX11 -lXext -lgfortran

You will need to include whatever libraries this command specifies.
However, even more libraries are probably needed. If you have a binary
distribution of NCL then the nclapi.a library will have references to
a number of different file format libraries, definitely including
NetCDF and HDF4, and most likely, the GRIB2, HDFEOS, and HDFEOS5
libraries. I am pretty sure these libraries will all have to be built
and linked into the executable in order to use nclapi.a. You can find
information about getting and building these libraries on the web site
at http://www.ncl.ucar.edu/Download/build_from_src.shtml. I sorry it
has to be so difficult and if more users become interested in using
the NCL API library then perhaps we can take steps to make it a bit
easier.
  -dave

On Sep 5, 2010, at 8:20 AM, linjun zou wrote:

> Hi, NCL group,
>
> I am learning to use NCL API in my C program, and use a
> simple example to have a try. The reference web page is http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclApi.shtml
> But when I compile the C program,I got many errors. I have appended
> "include" option and "library" option as the example introducion
> describes. The command is
> "gcc ncl.c -o ncl -I /home/zouheng/mysoftware/include/ -L/home/
> zouheng/mysoftware/lib -lnclapi",
> and I am sure that the header file and library file is in the
> appropriate
> location. The result is as follows:
>
> /home/zouheng/mysoftware/lib/libnclapi.a(NclAtt.o): In function
> `AttAddFunction':
> NclAtt.c:(.text+0x474): undefined reference to `NrmStringToQuark'
> NclAtt.c:(.text+0x53d): undefined reference to `NhlPError'
> NclAtt.c:(.text+0x557): undefined reference to `NrmStringToQuark'
> NclAtt.c:(.text+0x5c2): undefined reference to `NrmStringToQuark'
> NclAtt.c:(.text+0x636): undefined reference to `_NhlCBCallCallbacks'
> NclAtt.c:(.text+0x793): undefined reference to `NhlPError'
> NclAtt.c:(.text+0x7e4): undefined reference to `NhlPError'
> NclAtt.c:(.text+0x83b): undefined reference to `_NhlCBDelete'
> NclAtt.c:(.text+0x902): undefined reference to `_NhlCBDelete'
> NclAtt.c:(.text+0x976): undefined reference to `NhlPError'
> /home/zouheng/mysoftware/lib/libnclapi.a(NclAtt.o): In function
> `AttDelParent':
> NclAtt.c:(.text+0xd9f): undefined reference to `NhlPError'
> /home/zouheng/mysoftware/lib/libnclapi.a(NclAtt.o): In function
> `AttDelFunction':
> NclAtt.c:(.text+0xe43): undefined reference to `NrmStringToQuark'
> NclAtt.c:(.text+0xea1): undefined reference to `NrmStringToQuark'
> NclAtt.c:(.text+0xede): undefined reference to `_NhlCBCallCallbacks'
> NclAtt.c:(.text+0xee9): undefined reference to `NrmStringToQuark'
>
> It seams that the error is occurred in the library "libnclapi.a".
> But I have tried to use a new libnclapi.a
> to replace the old one,and it doesn't work. I don't know how to
> solve this problem,can you tell me what the
> reason is and give me some advice.
> Thanks a lot and best regards!
>
> linjun
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Sep 5 14:11:45 2010

This archive was generated by hypermail 2.1.8 : Thu Sep 16 2010 - 11:05:25 MDT