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

Visual Studio Project Dependencies

OP1
New Contributor II
951 Views

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
Steve_Lionel
Honored Contributor III
939 Views

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.

0 Kudos
Reply