Dependency problem

Dependency problem


I am using Visual Studio 2010 Professional and Intel Fortran

I have just come across a strange problem where the compiler is able to compile and link the program
that has a bug.

I have included a pdf file with screenshots of the steps I took, and a zip file with the sample code.

I am not sure if it the problem with Visual Studio, the Fortran compiler, or if I made a mistake
with my settings.


Downloadapplication/pdf dependency-problem.pdf220.26 KB
Downloadapplication/zip ifc-test.zip3.45 KB
6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I don't know whether it is by design, but what you are seeing is a symptom of the dependency analysis undertaken by the Fortran integration not spanning across projects - i.e. if you make a change in the interface to a procedure in a module in a child project (the lib), you need to manually rebuild the parent project (the exe). This has been the case for some years (perhaps since VS2010 or maybe ifort 12.0, perhaps forever and I just never noticed).

There is some justification for this to be by design, as in large solutions the compilation cascade caused by changing a module can be rather time consuming. If the change is in the executable part of a procedure rather than its interface.there is no change in the object code generated when downstream program units are compiled (in the absence of IPO, etc). The project boundary provides a reasonable compromise for the programmer to manually manage whether a rebuild is required, and I've certainly take advantage of it to reduce build times (particularly earlier this year when some updates of ifort 12.1 took almost a day, each, to do a debug build of a couple of my source files).

But yes, if you change the interface and don't rebuild, then all sorts of fun stuff starts happening.

It has been my experience that it is much better to directly include libraries as project components, rather than put them in the dependencies list. However, this does not mean that library functions are checked for interface consistency at each compile,


Downloadimage/jpeg dependencies.jpg6.75 KB

Thanks for the replies.
I did some more experimenting, and I think I solved the problem if a put the path of the compiled library module files
into the main program's "Additional Include Directories" field. Have a look at the attached image.
I'm still not sure if this is a valid solution.


Downloadimage/jpeg main-property.jpg50.25 KB

That's an integration glitch if that is the case - dependencies that are Fortran projects automatically get added to that list in the background (have a look at the command line for the exe project and note the magic /Ixxx options).

Yes, you are correct, that include directory is already there on the command line.
What I just noticed is that if I include it again in the "Additional Include Directories" field,
the same /I option is repeated twice, and the bug always gets caught.
If I do not include it, the /I is still there (but only one time), and the bug is not caught.

Leave a Comment

Please sign in to add a comment. Not a member? Join today