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

[netCDF #OXF-630724]: issue when compiling



Hi Thom,

It appears that when trying to link your executable, the linker is unable to 
find the various _nc_ functions, such as those referenced below.  This 
immediately suggests that the linker is not trying to link against libnetcdf, 
typically specificed with -lnetcdf.  If it were trying to link but unable to 
find the library, I would expect to see an error indicative of a 'file not 
found'-type situation.  

Are you passing -lnetcdf to your compiler?  If so, can you provide the command 
you are using to compile your test program? I will take a look and try to sort 
out what is going on.

Thanks!

-Ward

> Hey,
> My names Thom McDonnell, i'm currently trying to use the netcdf libraries
> with .SOFA files. I'm on a mac, OS X 10.10, and trying to use the netcdf
> library (installed via homebrew), and writing and compiling code via atom,
> and directly via terminal. The newest Xcode, and Xcode command line tools
> are installed too.
> 
> When I compile any of the example codes from the website, or my own code
> calling the functions of  netcdf.h I get slight variations of this error.
> (depending both on the functions called, and how many functions are called)
> 
> Undefined symbols for architecture x86_64:
> "_nc_close", referenced from:
> _main in NCOtest-25d970.o
> "_nc_get_var_float", referenced from:
> _main in NCOtest-25d970.o
> "_nc_get_vara_float", referenced from:
> _main in NCOtest-25d970.o
> "_nc_inq_varid", referenced from:
> _main in NCOtest-25d970.o
> "_nc_open", referenced from:
> _main in NCOtest-25d970.o
> "_nc_strerror", referenced from:
> _main in NCOtest-25d970.o
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
> 
> when I compile via terminal with -v it gives me this again, with no further
> details.
> Would you possibly be able to direct me to my error, or how i may be able
> to rectify this. (having looked at the website - I tried to find similar
> issues in the known problems sections, but could not find this issue)
> 
> Thanks
> Thom
> 
> 


Ticket Details
===================
Ticket ID: OXF-630724
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.