Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
32 Views

Compilation error: The sample Fortran code linked to Intel ODE solver

Hi,

I have Intel Parallel Studio Composer Edition for Fortran Windows (2017) which is integrated into Visual Studio 2015. 

I am trying to compile a sample Fortran code linked to libiode_ia32.lib using above platform. I got both the sample code and the library from  https://software.intel.com/en-us/protected-download/267266/145019/step2

I get the following error:

       Code / Description / File

Error error LNK2001   /   unresolved external symbol _printf / libiode_ia32.lib(dodesol_mk52lfa.obj)

Any idea? 

 

0 Kudos
6 Replies
Highlighted
32 Views

What can you tell us about your configuration?   It's possible you've got it configured for 64-bit.

This is an entry point in the 32-bit C runtime library, and judging solely on the name of your library, it too is a 32-bit library.

                      --Lorri

0 Kudos
Highlighted
Beginner
32 Views

 

Hi Lorri,

Unfortunately, that is not the case. My configuration is x86 corresponding to 32-bit.

/Iman

 

0 Kudos
Highlighted
Black Belt
32 Views

That Intel ODE library was made available many years ago (2008). I find that the sample program builds fine with IFort 15 and earlier (I tried 2013 SP1, and the older 11.1). It fails with Parallel Studio 2016 and newer. The failure of the 2017 compiler to find _printf has probably more to do with the Microsoft C runtime than anything that Intel did.

If you have on your PC, or someone else's PC, one of those older versions of Intel Fortran, you can build a DLL and the matching import library. Once this is done, you can use that pair of files to link and run your application using a more recent version of Intel Fortran. I just tried this with the 32-bit version of Ifort 18.0.3, and it works fine. If you are not familiar with building DLLs and import libraries, perhaps Intel can do so, or give me permission to post the files myself, and I will be happy to provide them in 32-bit and 64-bit versions.

P.S.: It is sufficient to have the MS C library msvcrt.lib from VS2005, or probably something similar from 2001-2010. Having an older version of Intel Fortran is not necessary. See #6 and #7.

0 Kudos
Highlighted
32 Views

I did ask for a log, but I think that mecej has the right answer ..

0 Kudos
Highlighted
Black Belt
32 Views

Lorri, I usually don't use VS for anything other than debugging. [This was in answer to Lorri's request, now edited out, to provide the build log]

I created a .DEF file containing

LIBRARY IODE32.DLL
EXPORTS
DODESOL_RKM9ST
DODESOL_RKM9MKN
DODESOL_RKM9MKA
DODESOL_MK52LFN
DODESOL_MK52LFA
DODESOL

and used the commands below in an IFort 2015 command window:

lib /def:iode32.def /machine:i386
ifort /DLL iode32.exp libiode_ia32.lib msvcrt.lib

to build the DLL and the import library. Then, I built the example in an IFort 2018 command window with the command

ifort xiode.f iode32.lib

The list of symbols in my .DEF file is probably incomplete, since I put in just the few names that I spotted as probably relevant to building the example.

P.S.: It turns out that having an older version of Intel Fortran installed is not really necessary. All that one needs is an older MSVCRT.LIB, such as the one that was included in VC2005 and CVF6.6. To build the DLL, do

lib /def:iode32.def /machine:i386
cl /LD iode32.exp libiode_ia32.lib c:\lang\CVF\VC98\LIB\msvcrt.lib

The last part of the second command should be the complete path to the old version MSVCRT library file.

0 Kudos
Highlighted
Beginner
32 Views

Hi mecej4,

Following your instruction, I could create the DLL and then link it to the VS project. It seems that the compilation error does not appear anymore. Thanks :)

/Iman

 

0 Kudos