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

mixed language project not including static libraries

martymike
Novice
781 Views
I am porting many projects from a IVF 10.1/VS2008 environment (~200 solution and project files). We have Fortran projects, C/C++ projects, and Custom build projects. There are only a few that build exe files with a C/C++ main project and including a dependent Fortran project. However, none of those link. In the Fortran static library is not included in the link command. Of course, I can add it, but this was not necessary before. I checked that the Link Library Dependencies option is set to Yes. Any ideas?
0 Kudos
5 Replies
TimP
Honored Contributor III
781 Views
Are you running into the incompatible defaults in the Visual Studio options on static vs. dynamic libraries? You should change those so they agree.
0 Kudos
martymike
Novice
781 Views

I'm not sure what you mean. On the Property Pages for the dependent Fortran project, on the General page, there is aproperty for "Configuration Type".It says "Static Library" and is grayed out - I couldn't change it if I wanted to. I'm not doing something silly like specifying /dll to the compiler (this solution did work in 2008 before the conversion, after all). If you are talking about agreement between the linker Output File property for the main project agreeing with the General Page properties of Output Directory, Target Name, and Target Extension (which VS 2010 is *much* more fussy about than 2008 was) they agree (at least they do now - the conversion report yelled at me about it). I've tried removing the Fortran project and adding it back in in case the conversion lost it somehow, but that didn't work either.

0 Kudos
Xiaoping_D_Intel
Employee
781 Views
VS2010 has moved project dependencies from solution files to project files. The project references should be added to the Framework and Reference section of the C++ projects Properties dialog.

Unfortunately VS2010 doesn't support adding Fortran project into the project reference list so you have to add those fortranlib files and lib searching path into the C++ project manually.

For a Fortran project it still supports automatically reference the libs from other projects it depends on.

0 Kudos
Steven_L_Intel1
Employee
781 Views
This text from the Fortran release notes may help.

Adjusting Project Dependencies

If you are converting a project from an earlier version of Visual Studio and had established
Project Dependencies, these are converted to References by Visual Studio 2010. A Fortran
project that is referenced by a C/C++ project will prevent the C/C++ project from building, with
an MSB4075 error. To solve this:

1. Right click on the C/C++ project and select References.
2. If any Fortran project is shown as a reference, click Remove Reference. Repeat this for
all Fortran projects shown as a reference. Click OK.
3. Repeat the above steps for any other C/C++ project

Now you have to reestablish project dependencies.

1. Right click on the C/C++ project and select Project Dependencies.
2. Check the box for each project that is a dependent of this project.
3. Click OK.
4. Repeat the above steps for any other C/C++ project that has dependencies.

Unlike earlier versions of Visual Studio, Visual Studio 2010 does not automatically link in the
output library of dependent projects, so you will need to add those libraries explicitly to the
parent project under Linker > Additional Dependencies. You can use the Visual Studio macros
$(ConfigurationName) and $(PlatformName) as required to qualify the path. For example:
..\FLIB\$(ConfigurationName)\FLIB.lib
Where $(ConfigurationName) will expand to Release or Debug, as appropriate. Similarly,
$(PlatformName) will expand to Win32 or x64 as appropriate.
0 Kudos
martymike
Novice
781 Views
I'm sorry that I missed that note. Thanks for the help, that's got it working.
0 Kudos
Reply