NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

Re: [netcdf-porting] NetCDF and Visual Studio 2008

Hi,

I still have not managed to compile NetCDF from sources, but the
3.6.1-win32 binaries plus the netcdf.h file from the 3.6.1 source
distribution did the job.

I found that adding the line

#pragma comment (lib, "netcdf")

to the <netcdf.h> file makes it much easier to use NetCDF from Visual
C++. This directive causes the linker to include "netcdf.lib", so you
do not need to edit linker options separately for each program. I hope
this tip is useful for other VC++ users.

Maciej.