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

linker search order no longer applies?

dajum
Novice
313 Views
Hi,

We have been using a "feature" of the linker for years that I find no longer works. We compile a main routine and some associated routines and then link with a very large library. If we want to build an executable that uses a different version of a subroutine that is in the library we would just add it to the main file and compile and link it. Now I find that we get a fatal LNK2005 error that says the routine is multiply defined. I know it is and want to use the behavior that the linker used a fixed order to resolve references in the code and use the routine from the object file just compiled and not the routine in the library.

Is there a way around LNK2005 without removing the routine from the library?

Thanks,

Dave
0 Kudos
1 Reply
dajum
Novice
313 Views
I found the problem! It appears that every routine that was in the original compilation unit must also be in the new unit. WHy this is - and why the error message doesn't indicate this is still puzzling to me.

Dave
0 Kudos
Reply