Community
cancel
Showing results for 
Search instead for 
Did you mean: 
jeffhamann
Beginner
168 Views

Visual Studio 2017 will not compile FORTRAN files in Mixed-Language solutions/projects.

Jump to solution

 

I use Microsoft Visual Studio 2017 Community Edition on a Windows 10 (64-bit) virtual machine and need to build 64-bit mixed-language applications. Specifically, I need to add a few FORTRAN files to an existing Visual Studio C/C++ project. Nothing extreme, just add the FORTRAN files, compile the source code and be able to step through the code from the C calling function into the FORTRAN source. I’ve been doing this since Developer Studio 6 and Visual Fortran 6.

I’ve downloaded and installed the Intel oneAPI Base and oneAPI HPC Toolkits and have been successful in building and debugging simple FORTRAN projects when I use the “New->Project->Intel Fortran.

I’ve followed the suggestions from the following pages:

https://software.intel.com/content/www/us/en/develop/articles/troubleshooting-fortran-integration-is...

and

https://software.intel.com/content/www/us/en/develop/articles/problem-fortran-source-files-not-compi...

and I still cannot get Visual Studio to compile the file.

The right-click “compile” pop-up menu item in the Solution Explorer remains grayed/inactive.  The file properties for the document properties for the FORTRAN file are presented below:

jeffhamann_0-1610580668721.png

The FORTRAN options from the "Options" menu in Visual Studio: 

VirtualBox_RFP-WIN10-VS2017-3.0_13_01_2021_15_33_34.png

 

I’m out of ideas. Help!

 

The installed tools for Visual Studio are:

Microsoft Visual Studio Community 2017

Version 15.9.31

VisualStudio.15.Release/15.9.31+28307.1342

Microsoft .NET Framework

Version 4.8.03752

 

Installed Version: Community

 

Visual C++ 2017   00369-60000-00001-AA139

Microsoft Visual C++ 2017

 

ASP.NET and Web Tools 2017   15.9.04012.0

ASP.NET and Web Tools 2017

 

Azure App Service Tools v3.0.0   15.9.03024.0

Azure App Service Tools v3.0.0

 

C# Tools   2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a

C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

 

Common Azure Tools   1.10

Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

 

Cookiecutter   15.9.18254.1

Provides tools for finding, instantiating and customizing templates in cookiecutter format.

 

GitHub.VisualStudio   2.11.106.19330

A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

 

Intel Libraries for oneAPI   Package ID: w_oneAPI_2021.1.1.99

Intel Libraries for oneAPI – toolkit version: 2021.1.1, extension version 21.1.0.15, Package ID: w_oneAPI_2021.1.1.99, Copyright © 2019-2020 Intel Corporation. All rights reserved.

* Other names and brands may be claimed as the property of others.

 

Intel® C++ Compiler   Package ID: w_oneAPI_2021.1.1.99

Intel® C++ Compiler – toolkit version: 2021.1.1, extension version 21.0.15, Package ID: w_oneAPI_2021.1.1.99, Copyright © 2002-2020 Intel Corporation. All rights reserved.

* Other names and brands may be claimed as the property of others.

 

Intel® C++ Compiler Classic   Package ID: w_oneAPI_2021.1.1.99

Intel® C++ Compiler Classic – toolkit version: 2021.1.1, extension version 19.2.5.15, Package ID: w_oneAPI_2021.1.1.99, Copyright © 2002-2020 Intel Corporation. All rights reserved.

* Other names and brands may be claimed as the property of others.

 

Intel® Fortran Compiler   Package ID: w_oneAPI_2021.1.2.148

Intel® Fortran Compiler – toolkit version: 2021.1.2, extension version 19.2.0061.15, Package ID: w_oneAPI_2021.1.2.148, Copyright © 2002-2020 Intel Corporation. All rights reserved.

* Other names and brands may be claimed as the property of others.

 

Intel® Inspector 2021.1   604894

Intel® Inspector 2021.1, (build 604894), Copyright © 2009-2020 Intel Corporation. All rights reserved.

 

Intel® oneAPI DPC++ Compiler   Package ID: w_oneAPI_2021.1.1.99

Intel® oneAPI DPC++ Compiler – toolkit version: 2021.1.1, extension version 21.1.0.15, Package ID: w_oneAPI_2021.1.1.99, Copyright © 2019-2020 Intel Corporation. All rights reserved.

* Other names and brands may be claimed as the property of others.

 

Intel® oneAPI Menu & Samples   1.0.387

Intel® oneAPI Visual Studio Menu & Samples Extension

 

JavaScript Language Service   2.0

JavaScript Language Service

 

Microsoft Azure Tools   2.9

Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.20417.1

 

Microsoft JVM Debugger   1.0

Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

 

Microsoft MI-Based Debugger   1.0

Provides support for connecting Visual Studio to MI compatible debuggers

 

Microsoft Visual C++ Wizards   1.0

Microsoft Visual C++ Wizards

 

Microsoft Visual Studio VC Package   1.0

Microsoft Visual Studio VC Package

 

MLGen Package Extension   1.0

MLGen Package Visual Studio Extension Detailed Info

 

NuGet Package Manager   4.6.0

NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

 

ProjectServicesPackage Extension   1.0

ProjectServicesPackage Visual Studio Extension Detailed Info

 

Python   15.9.18254.1

Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.

 

Python - Django support   15.9.18254.1

Provides templates and integration for the Django web framework.

 

Python - IronPython support   15.9.18254.1

Provides templates and integration for IronPython-based projects.

 

Python - Profiling support   15.9.18254.1

Profiling support for Python projects.

 

R Tools for Visual Studio   1.3.40517.1016

Provides project system, R Interactive window, plotting, and more for the R programming language.

 

Test Adapter for Boost.Test   1.0

Enables Visual Studio's testing tools with unit tests written for Boost.Test.  The use terms and Third Party Notices are available in the extension installation directory.

 

Test Adapter for Google Test   1.0

Enables Visual Studio's testing tools with unit tests written for Google Test.  The use terms and Third Party Notices are available in the extension installation directory.

 

TypeScript Tools   15.9.30718.2001

TypeScript Tools for Microsoft Visual Studio

 

Visual Basic Tools   2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a

Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

 

Visual Studio Code Debug Adapter Host Package   1.0

Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

 

Visual Studio Tools for CMake   1.0

Visual Studio Tools for CMake

 

 

 

Labels (2)
0 Kudos

Accepted Solutions
Igor_V_Intel
Employee
104 Views

Actually, Visual Studio does not accept projects of mixed language. It is not possible to have both Fortran and C++ files compilable from the same C++ project. You need create 2 different projects under same solution in Visual Studio. Please refer for this thread for more details:

https://stackoverflow.com/questions/56690536/mixed-language-in-visual-studio


View solution in original post

4 Replies
AbhishekD_Intel
Moderator
133 Views

Hi,


Thanks for reaching out to us.

We are moving this issue to the Intel Fortran Forum.


Warm Regards,

Abhishek


Arjen_Markus
Valued Contributor III
121 Views

This is a limitation of Visual Studio: it does not handle source files from different languages in one and the same project. You will need to define a new project within the solution that holds the Fortran sources. When you have done that (and set the dependencies, so that at link time all the libraries produced by the various projects are included), it is quite possible to debug the C and the Fortran source code. The problem is at the level of the VS projects.

cryptogram
Beginner
110 Views

Arjen is correct. I'm working on a solution combining Visual Basic, C# and C at the moment.

When you create a brand new project, you may have noticed that you get a directory corresponding to the project name, and another below it with the same name.  The higher level directory is actually for the solution, and it's where the solution file is located.  The project is in the subdirectory.

But you can add more projects to the solution and these will each get their own subdirectory under the

solution directory.

 

Igor_V_Intel
Employee
105 Views

Actually, Visual Studio does not accept projects of mixed language. It is not possible to have both Fortran and C++ files compilable from the same C++ project. You need create 2 different projects under same solution in Visual Studio. Please refer for this thread for more details:

https://stackoverflow.com/questions/56690536/mixed-language-in-visual-studio


View solution in original post