Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Mixing Fortran/C++

Elizabeth_W_1
초급자
866 조회수
Hi everyone, I'm mixing Fortran/C++ in a project. I've looked through the forum and online, but haven't found a solution to my problem. I've followed the instructions to configure Visual Studio for mixing languages at https://software.intel.com/en-us/articles/configuring-visual-studio-for-mixed-language-applications I have a Fortran library that has the iso_c_binding interface for C/C++ users. I've used Visual Studio and the Intel compiler to create a static library for this project. Then I used VS and the C++ compiler to compile a second library of C++ subroutines that call the Fortran library. (These would be the routines used by the C++ users). I've got an example that I'm trying to compile and link to these two libraries, but I get an error: LINK : fatal error LNK1104: cannot open file 'ifmodintr.lib' I have no trouble doing all of this on other platforms but I'm a bit lost with Visual Studio. Any help would be most appreciated. Thanks in advance. Elizabeth
0 포인트
4 응답
mecej4
명예로운 기여자 III
865 조회수

The library in question (ifmodintr.lib) is located in the ...\compiler\lib\ia32 and ..\compiler\lib\intel64 directory of your Intel Fortran installation. It is probably the case that the Fortran library that you created contains references to ifmodintr.lib. Simply provide the appropriate version of this library as an additional library to search at link time in your C++ project.

If you prefer the command line and, perhaps, makefiles, you can build just as easily as you would in bash/csh/ksh.

0 포인트
FortranFan
명예로운 기여자 III
865 조회수

Elizabeth W. wrote:

Hi everyone,

I'm mixing Fortran/C++ in a project. I've looked through the forum and online, but haven't found a solution to my problem.

I've followed the instructions to configure Visual Studio for mixing languages at
https://software.intel.com/en-us/articles/configuring-visual-studio-for-...

...

I've got an example that I'm trying to compile and link to these two libraries, but I get an error:
LINK : fatal error LNK1104: cannot open file 'ifmodintr.lib'

..

Even though you indicate you followed the instructions to configure Visual Studio, it appears something is not quite right: I suggest revisiting the "Configuring for Microsoft Visual Studio" section at the link you used and checking everything closely.  The error about ifmodintr.lib suggests the Library Directories setting for $(IFORT_COMPILER[vv])\compiler\lib.. may be amiss.

0 포인트
Elizabeth_W_1
초급자
865 조회수

Yes I did end up messing it up.  I forgot I was using a new machine with 2015 Composer.  I did follow the instructions at "Configuring for Microsoft Visual Studio" but mistakenly replaced [vv] with 14.  The correct value is 15 (though it's not stated in the linked page, which is a few years old).  I was then able to compile and run my programs.  Thanks again.

0 포인트
Steven_L_Intel1
865 조회수

The article has now been updated. I don't know how we missed that one...

0 포인트
응답