Errors getting NetCDF 4 to compile using intel fortran 11.1

Errors getting NetCDF 4 to compile using intel fortran 11.1

I'm running VS 2008, intel fortran 11.1I got pre-build binaries fromChristoph Gohlke's netcdf4 build

 http://www.lfd.uci.edu/~gohlke/netcdf-4.1.3-win-dev.zip

I would love to use the more recent release from Unidata athttp://www.unidata.ucar.edu/software/netcdf/win_netcdf/#compnotesbut it appears to be only for C and I need to compile in fortran.Maybe there is something I don't understand.

So using Gohlke's build, I put all the .dll intoc:\\WINDOWS\\system32\\
At top of my program I have include statement: INCLUDE 'X:\\netcdf\\netcdf4_intel\\netcdf-4.1.3-win-dev\\netcdf-4.1.3-curl-fortran\\fortran\\netcdf.inc'Then I use a .bat to compile (added as external tool)
My netcdf4_x64.bat file is as
follows:
set linkerpath=C:\\Program Files
(X86)\\Intel\\ComposerXE-2011\\bin
set
NETCDF=X:\\netcdf\\netcdf4_intel\\netcdf-4.1.3-win-dev
set
PATH=%NETCDF%\\bin\\x64;%PATH%
set LIBDIR=%NETCDF%\\lib\\x64
call
"%linkerpath%\\ifortvars.bat " intel64 vs2008
"%linkerpath%\\intel64\\ifort.exe"
^
/exe:%2 /fpp /module:C:\\fortran_tools\\trash ^
/gen-interfaces:nosource
/Qsave-temps- /Qsave /Qvec-report0 /heap-arrays:1000
^
/check:bounds,format,pointers,uninit /libs:dll /threads /nologo
/extend-source:132 /traceback ^
/warn:unused,interfaces,uncalled
/assume:byterecl /libs:dll /F40000000 ^
%1 /link /libpath:"%LIBDIR%"
netcdf.lib

When I compile using just a straight x64.bat, I get the
following error:
LINK : fatal error
LNK1104: cannot open file 'netcdf.LIB'
This is exactly what I expect,
since x64.bat doesn't have any netcdf linking.

Now if I compile using
netcdf4_x64.bat
I get the following errors:
cdf2fortranv2_SMOS.obj : error LNK2019: unresolved
external symbol NCOPN referenced in function MAIN__
cdf2fortranv2_SMOS.obj :
error LNK2019: unresolved external symbol NCINQ referenced in function
MAIN__
So, to me this means that it is actually finding the netcdf.lib
file correctly, but for some reason isn't finding all the netcdf functions.....
Do you have an insight into this?

ANY help appreciated!Thanks,Chelle

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hello Chelle,

based on my experience with old versions of netcdf (3.6.1) and ivf this error shows that the compiler is not finding all needed files. We have added all needed files into the ivf and win directories:

lib and include files into the ivf compiler directory (.../intel/compiler/xx.x/xxx/lib and include)

all needed exe files were placed into the win ... systems directory

If you are able to build a complete and working uptodate netcdf project with ivf-win i think many people would be appriciated if you would provide a documentation and all needed files somewhere.

Frank

Frank,Yes I am taking careful notes & am happy to post results, once I get it working.I have 2 .bat files to compile. normal_x64.bat and netcdf_x64.batTake a very simple test program program test_prog implicit none INCLUDE 'X:\netcdf\netcdf4_intel\netcdf-4.1.3-win-dev\netcdf-4.1.3-curl-fortran\fortran\netcdf.inc' print *, 'NetCDF version: ', nf_inq_libvers() print *, '*** SUCCESS!' endIf I compile with normal_x64.bat I get the error:LINK : fatal error LNK1104: cannot open file 'netcdf.LIB'This is what I expect. If I compile with netcdf_x64.bat where I have told it where .lib & includes areI get this error:test_prog.obj : error LNK2019: unresolved external symbol NF_INQ_LIBVERS referenced in function MAIN__So, it is finding the netcdf.lib but for some reason is able to recognize any netcdf functions.I then did as you suggested & copied lib & include files to compiler directory.Now, my normal_x64.bat gives me same error as my netcdf_x64.battest_prog.obj : error LNK2019: unresolved external symbol NF_INQ_LIBVERS referenced in function MAIN__So I think this is telling me same thing, I can either compile by coping intodefaut directories the normal compiler searches & just use normal_x64.bator I can keep files in separate location and tell compiler where to search & use netcdf_x64.batBut.... this doesn't solve my problem of the compiler finding netcdf.lib but not recognizing thenetcdf functions.....Any further help very appreciated!Thanks,Chelle

Lorri Menard (Intel)'s picture

Have you confirmed that the entry point NF_INQ_LIBVERS (exactly like that) is found in netcdf.lib?

--Lorri

Hi Forum,

I'm not sure if this thread has been taken up somewhere else- however I also have a Win-7 application (32 or 64bit) which would benefit from using NetCDF 4 for dealing with very large files (the code uses the Winteracter suite of libraries for visualising data from air pollution simulations). I have also been using the pre-build binaries from Christoph Gohlke's netcdf4 build.

Lorri's comment above -have you confirmed that the entry point NF_INQ_LIBVERS (exactly like that) is found in netcdf.lib- does identify one issue in that netcdf.lib is expecting entry points of the type nf_inq_libvers_

However this appears solveable by placing pre-processor delcarations in the netcdf.inc file i.e.

 external        nf_open
!DEC$ ATTRIBUTES ALIAS: 'nf_open_' :: nf_open

In doing this I am able to compile and link my software application.

However when trying to run the software I get the error R603- an application has made an attempt to load the C runtime library incorrectly. I have installed the C redistributable package, however I'm guessing it may be necessary to link in a manifest file for the C libraries?

Could someone please advise?

Many thanks

Martin

Microsoft Visual Studio 2010
Version 10.0.40219.1 SP1Rel
Microsoft .NET Framework
Version 4.0.30319 SP1Rel
Intel(R) Visual Fortran     Package ID: w_fcompxe_2013.2.149
Intel(R) Visual Fortran Composer XE 2013 Update 2 Integration for Microsoft Visual Studio* 2010, 13.0.3615.2010, Copyright (C) 2002-2013 Intel Corporation

Login to leave a comment.