[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20030327: netCDF 3.5.0, ncgen, and missing symbols



Linus,

> To: address@hidden
> From: Linus Kamb <address@hidden>
> Subject: netCDF 3.5.0, ncgen, and missing symbols
> Organization: UCAR/Unidata

The above message contained the following:

> I am trying to install and evaluate netCDF for my purposes, and am
> running into a bit of trouble.
>
> I am trying to compile the C code generated by ncgen for the example
> CDL file given in the C docs.
>
> ncgen seems to work fine and produces valid C code, but when I try to
> compile the code, I get the following link errors:
> 
> 
> 142 cdl> gcc -L../netcdf/lib -lnetcdf -I../netcdf/include create_example.c
> Undefined                       first referenced
>   symbol                             in file
> nc_put_att_text                     /var/tmp/ccBeaWpv1.o
> nc_def_var                          /var/tmp/ccBeaWpv1.o
> nc_put_vara_float                   /var/tmp/ccBeaWpv1.o
> nc_strerror                         /var/tmp/ccBeaWpv1.o
> nc_close                            /var/tmp/ccBeaWpv1.o
> nc_put_att_double                   /var/tmp/ccBeaWpv1.o
> nc_create                           /var/tmp/ccBeaWpv1.o
> nc_def_dim                          /var/tmp/ccBeaWpv1.o
> nc_put_vara_short                   /var/tmp/ccBeaWpv1.o
> nc_enddef                           /var/tmp/ccBeaWpv1.o
> nc_put_var_int                      /var/tmp/ccBeaWpv1.o
> ld: fatal: Symbol referencing errors. No output written to a.out
...
> I have looked in libnetcdf.a and those symbols appear to be defined there.

Change the compile/link command to 

    gcc -I../netcdf/include create_example.c -L../netcdf/lib -lnetcdf 

A Library reference must appear after the modules that use it.

> (As an aside, I had some trouble with building the distribution:
> configure was finding that the size of all my data types was 0 bytes.

That is not good.  If you still have problems after correcting your
command-line and want me to investigate, then please following the
reporting instructions near the end of the file INSTALL.html.

> It has been quite a while since I have tried building C code, so I
> apologize if this is a stupid compile problem on my part.

There are no stupid questions.

> Which leads to another question: is there, or will there be, an option
> for ncgen to generate Java code?

Our resources for netCDF development are quite limited, so I wouldn't
expect a solution anytime soon.

> Thanks,
> Linus
> 
> -- 
> Linus Kamb
> address@hidden
> (206) 547-0393 x106

Regards,
Steve Emmerson