Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

Visual Studio Project Dependencies

New Contributor I

Assume your PSXE2020U1/VS2017 solution contains three Fortran projects: a main executable E, and two static libraries L1 and L2. E calls a procedure P1 contained in a module of L1; and that P1 procedure, in turn, calls a procedure P2 contained in a module of L2.

In Visual Studio, using the contextual menu "Build Dependencies" / "Project Dependencies" i can describe the dependency of L1 upon L2.

What surprises me is that when it comes to the list of dependencies of E, that list needs to include BOTH L1 and L2 for E to build. If I only list L1 (under the assumption that the cascading dependency on L2 is properly accounted for) then I can compile my code but not build it (unresolved external symbol for P2).

Is this the normal behavior, or am I missing something?

0 Kudos
1 Reply
Black Belt Retired Employee

What you're missing is that VS uses the build dependencies to also create link dependencies. When you link an EXE or DLL, it will add to the link the output library of any dependent project. But when you have two static libraries, where one depends on the other, the default is to not follow the dependency chain. To fix that, set the L1 property Librarian > General > Link Library Dependencies to Yes.