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

Connecting VC 2005 with Intel Fortran

sarma_amras
New Contributor I
417 Views

Hi,

I would like to connect the VC 2005(Profession) with Intel Fortran(9.1) using the VC IDE.

May I please know how can I do this.

Regards

Kameswara Sarma

0 Kudos
1 Solution
Steven_L_Intel1
Employee
417 Views

Sorry, I did not understand the question. You want to build a mixed C and Fortran application.

  • First, please download and install Service Pack 1 for Visual Studio 2005. This resolves a Microsoft bug relating to dependent projects.
  • The C code will need to be in a C++ Static Library project in your solution. Once you have that, right click on the Fortran project and select the C project to be a dependent of the Fortran project
  • Make sure that the run-time library types match between C and Fortran. In the C project, the property is under Code Generation, in Fortran, Libraries
  • I note that the Fortran program is looking for _c_fun. That suggests to me that you compiled with the /names:lowercase option. I don't recommend that - a better choice is to use !DEC$ ATTRIBUTES ALIAS to rename C_FUN or spell the C routine in upper case.

That should do it. Since you are using an old version (11.0 is current), you don't have available the samples that were added in 10.0. Those include mixed-language projects.

View solution in original post

0 Kudos
3 Replies
Steven_L_Intel1
Employee
417 Views

It should work automatically after you install the compiler. Open Visual Studio, click Help > About. Click Copy Info and then paste the contents into a reply here.

0 Kudos
sarma_amras
New Contributor I
417 Views

It should work automatically after you install the compiler. Open Visual Studio, click Help > About. Click Copy Info and then paste the contents into a reply here.

Steve this is the info abt the compiler

Microsoft Visual Studio 2005
Version 8.0.50727.42 (RTM.050727-4200)
Microsoft .NET Framework
Version 2.0.50727

Installed Edition: Professional

Microsoft Visual Basic 2005 77626-235-0521391-41820
Microsoft Visual Basic 2005

Microsoft Visual C# 2005 77626-235-0521391-41820
Microsoft Visual C# 2005

Microsoft Visual C++ 2005 77626-235-0521391-41820
Microsoft Visual C++ 2005

Microsoft Visual J# 2005 77626-235-0521391-41820
Microsoft Visual J# 2005

Microsoft Visual Web Developer 2005 77626-235-0521391-41820
Microsoft Visual Web Developer 2005

Crystal Reports AAC60-G0CSA4B-V7000AY
Crystal Reports for Visual Studio 2005


Intel Fortran Compiler Integration
Intel Fortran Compiler Integration for Microsoft Visual Studio 2005, Version 9.1.3427.2005, Copyright (C) 2002-2006 Intel Corporation

Fortran program:

program main

write(*,*)'Inside Fortran Function'

call c_fun

write(*,*)'Back to Fortran Function'

end

Cprogram:

#include

void

c_fun()

{

printf(

"Inside C n");

}

Error Message is :

error LNK2019: unresolved external symbol _c_fun referenced in function _MAIN__

Eagerly waiting for the solution and thanks in advance

Kameswara Sarma

0 Kudos
Steven_L_Intel1
Employee
418 Views

Sorry, I did not understand the question. You want to build a mixed C and Fortran application.

  • First, please download and install Service Pack 1 for Visual Studio 2005. This resolves a Microsoft bug relating to dependent projects.
  • The C code will need to be in a C++ Static Library project in your solution. Once you have that, right click on the Fortran project and select the C project to be a dependent of the Fortran project
  • Make sure that the run-time library types match between C and Fortran. In the C project, the property is under Code Generation, in Fortran, Libraries
  • I note that the Fortran program is looking for _c_fun. That suggests to me that you compiled with the /names:lowercase option. I don't recommend that - a better choice is to use !DEC$ ATTRIBUTES ALIAS to rename C_FUN or spell the C routine in upper case.

That should do it. Since you are using an old version (11.0 is current), you don't have available the samples that were added in 10.0. Those include mixed-language projects.

0 Kudos
Reply