I am going to use NetCDF in windows and I think it has to be compiled with MinGW since my main program and all other libraries are compiled with MinGW already.
But when I used MinGW (gcc version 4.6.2). I got some error messages:
Making all in liblib
make[2]: Entering directory `/c/Users/ylylyl/Documents/CB/NETCDF/netcdf-4.2.1.1/liblib'
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -I../include -DDLL_NETCDF -DDLL_EXPORT -g -O2 -MT libnetcdf_la-stub.lo -MD -MP -MF .deps/libnetcdf_la-stub.Tpo -c -o libnetcdf_la-stub.lo `test -f 'stub.c' ||echo './'`stub.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I../include -DDLL_NETCDF -DDLL_EXPORT -g -O2 -MT libnetcdf_la-stub.lo -MD -MP -MF .deps/libnetcdf_la-stub.Tpo -c stub.c -DDLL_EXPORT -DPIC -o .libs/libnetcdf_la-stub.o
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I../include -DDLL_NETCDF -DDLL_EXPORT -g -O2 -MT libnetcdf_la-stub.lo -MD -MP -MF .deps/libnetcdf_la-stub.Tpo -c stub.c -o libnetcdf_la-stub.o >/dev/null 2>&1
mv -f .deps/libnetcdf_la-stub.Tpo .deps/libnetcdf_la-stub.Plo
/bin/sh ../libtool --tag=CC --mode=link gcc -g -O2 -version-info 9:0:2 -no-undefined -Wl,--output-def,netcdfdll.def -o libnetcdf.la -rpath /usr/local/lib libnetcdf_la-stub.lo ../libdispatch/libnetcdf2.la ../libdispatch/libdispatch.la ../libsrc/libnetcdf3.la -lm
libtool: link: gcc -shared .libs/libnetcdf_la-stub.o -Wl,--whole-archive ../libdispatch/.libs/libnetcdf2.a ../libdispatch/.libs/libdispatch.a ../libsrc/.libs/libnetcdf3.a -Wl,--no-whole-archive -O2 -Wl,--output-def -Wl,netcdfdll.def -o .libs/libnetcdf-7.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libnetcdf.dll.a
Creating library file: .libs/libnetcdf.dll.a
libtool: link: (cd .libs/libnetcdf.lax/libnetcdf2.a && ar x "/c/Users/ylylyl/Documents/CB/NETCDF/netcdf-4.2.1.1/liblib/../libdispatch/.libs/libnetcdf2.a")
libtool: link: object name conflicts in archive: .libs/libnetcdf.lax/libnetcdf2.a//c/Users/ylylyl/Documents/CB/NETCDF/netcdf-4.2.1.1/liblib/../libdispatch/.libs/libnetcdf2.a
make[2]: *** [libnetcdf.la] Error 1
make[2]: Leaving directory `/c/Users/ylylyl/Documents/CB/NETCDF/netcdf-4.2.1.1/liblib'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/c/Users/ylylyl/Documents/CB/NETCDF/netcdf-4.2.1.1'
make: *** [all] Error 2
I have no idea of what is the problem within libtool. But I do think ar command needs more inputs. And maybe there are something wrong when generating the libtool script?
I searched online but I can't find any MinGW version NetCDF with fortran and f90 interface. Please give me a hand. Many thanks.