Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

One paricular program won't add into library archive

Status
Not open for further replies.

FiascoBurnett

Programmer
May 25, 2015
6
0
0
ZA
I have a Fortran library archive (libmy.a) that contains various subroutines.
I then try to add another one with:

ifort -c -O3 ~/mydir/sub.f
ar -rv ~/mydir/libmy.a sub.o

However, while libmy's attributes change, its size does not, so it seems as if sub is not being incorporated (and trying to use the library gives an error message "undefined reference to `sub_'".
The other subroutines in the library were added exactly like this, without any problems.
What reasons could there be for this particular subroutine not being incorporated?
 
No idea why rv does not work but you could do it in two steps
Code:
ar -dv ~/mydir/libmy.a sub.o
ar -qv ~/mydir/libmy.a sub.o
 
Thanks, but didn't make any difference.
There was a previous version of "reader.f", saved under the completely different name "a.f", in the same directory as "reader.f". Eventually I found that deleting this file lead to the "undefined reference to `reader_'" error. Renaming it to anything not ending in .f lead to this error as well.
I simply copied the contents of "reader.f" into "a.f", deleted the original "reader.f" and renamed "a.f" to "reader.f", after which everything worked.
So I found the solution, although I still do not know what the problem is. How the file "a.f" could have any influence when it is not referred to anywhere, remains a puzzle.
 
The name of the file does not matter : only the names of the subroutines, functions, modules... inside are important

François Jacq
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top