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

How to guarantee the correct build order within a project

Arjen_Markus
Honored Contributor II
1,476 Views
Hello,

using Visual Studio 2008 and Intel Fortran 11.1 I run into some nasty problems with the build order
within a project. I have a collections of source files and each contains a module. Some modules within
the project use other modules from that project. The problem I run into is that module A in file A may
use module B in file B, but file A is built _before_ module B, so that the compilation fails the first
time around. It does succeed the second time, because then file B has been compiled, so that the
intermediate file for module B is available.

Is there a way, short of refining the organisation in projects so that no such dependencies within
a project remain (*), to guarantee that file B is compiled before file A?

Regards,

Arjen

(*) Reorganising the project structure would be a thorough nuisance, as it would create countless
of little projects, and endless INCLUDE paths.
0 Kudos
4 Replies
IanH
Honored Contributor III
1,476 Views
The dependency analysis is supposed to sort that out for you automatically. I have seen it ocassionally get confused (for example - today I moved a module in its entirety between source files and that had the compiler gazing at its navel for a while), but it sorts itself out after a rebuild or two.

Make sure you don't have a cyclic dependency (A depends on B depends on C depends on A, etc).

You other post about re-build vs clean plus build makes me wonder whether there's something else going on.
0 Kudos
Arjen_Markus
Honored Contributor II
1,476 Views
I am pretty sure we do not have a cyclic dependency, but perhaps I am wrong. It seems a likely explanation
for this phenomenon, thoughI have seen successful single builds (even more awkward: some of my
colleagues working on this project do get a successful build in one go, others don't, while everything seems
to be the same: VS, Intel compiler, source code).

Regards,

Arjen
0 Kudos
jimdempseyatthecove
Honored Contributor III
1,476 Views
Arjen,

Try: Right-Click on Solution name
Build Order

Then examine the chosen build order. If this is not correct, click on the dependencies tab, then the projects pull-down tab will select the focus to one of your projects, then check the appropriate Depends on check boxes. Repete for each problematic project.

Also, re-examine your soruce code as you may have USE someModule that produces a circular list. On occasion I've had to split two modules into three (usually two code files with the contains subroutine/functions and one new module with the combined data).

Jim Dempsey
0 Kudos
Arjen_Markus
Honored Contributor II
1,476 Views
Argh!

We do have a circular dependency! Not in the files that caused most complaints though, but in
some other ones. Okay, clear enough, I will have to solve this one.

Regards,

Arjen
0 Kudos
Reply