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

Visibility of LIB files within a solution

clunk
Beginner
331 Views

We are attempting to migrate a rather large Fortran/C (mostly Fortran) program from VS 2003/IVF 8 to VS 2005/IVF 10.1. The program compiles and links just fine under the oldcombination, but fails to link when using the new combination. The problem lies in the fact that the main project cannot "see" the .lib files generated by the supporting projects in the solution. In order to get thesolution to link, Ihave to add the individual .lib files to the main project.

Is there some setting that I'm missing in either VS 2005 or IVF 10.1 that makes the libraries fromall of the projects in a solution available to the main project???

Thanks for any assistance,

cje

0 Kudos
4 Replies
Steven_L_Intel1
Employee
331 Views
You need to install VS2005 SP1 - this is a VS bug and is noted in the Fortran release notes as follows:

Mixed-Language Applications in Visual Studio 2005

In Microsoft Visual Studio 2005 with a C/C++ main program and a Fortran static library dependent project, Visual Studio no longer looks for the output file (typically a .lib) of non-C/C++ dependent projects. The alternative is to add the dependent project's .lib as a "source file" or to give its full path on the Linker property page as an "Additional Dependency". This issue is resolved in Visual Studio 2005 Service Pack 1.


0 Kudos
clunk
Beginner
331 Views

Thanks for the quick response, Steve. I just got everything installed on a new computer, so the Service Pack has not been pushed to me yet. I'll call our IT folks and get 'er done.

Guess it boils down to RTFM. Thanks again.

0 Kudos
clunk
Beginner
331 Views

Steve,

Just got Service Pack 1 installed and the issue is better, but still remains to some extent.

For my Solution, I am provided with several static libraries (no source code provided) and it seems that whenever one of these libraries calls a routine that is contained in a separate project (source code included in Solution), that I need to call in the .lib file for the separate project (i.e. precompiled static libraries cannotlink toproject libraries that are compiled as part of my solution).

Note that this solution compiles and links under VS 2003/IVF 8 without the need to add in the extra library links to the main project.

Any further ideas?

cje

0 Kudos
Steven_L_Intel1
Employee
331 Views
My guess is that the order of the libraries as presented to the linker is the issue. The way the Microsoft linker (and every other linker I have known) works is that it proceeds through the list of input files it is given - objects and libraries - and builds a list of resolved and unresolved symbols. For each input file, it keeps searchig that file until no further unresolved symbols are resolved, then closes it and moves to the next one.

So let's say you have libraries A, B and C. A has calls to routines in B, B has calls to routines in C and C has calls to routines in A. When the linker gets to C, it is done with A and B and if an unresolved reference would be satisfied by A, well, too bad.

It would be instructive to look at the link command as shown in the project build log, and perhaps compare that to what you see in VS2003. For the structure of your application, you may need to force one or more libraries to the end of the list, or even specify them twice (under "Additional Dependencies" in the Linker > Input property page.)

The compiler has no control over the order of libraries.
0 Kudos
Reply