For Programmers: Free Programming Magazines  


Home > Archive > Fortran > January 2006 > error when linking









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author error when linking
bowo

2006-01-26, 3:59 am

Hi all,
My program was compiled, and theres no error when compiling, only 2
warnings. The warning was about implicit statement that already been
defined.
I think that shouldn't stop me from building an executable file, but
when I bulit it the compiler said that there's an error when linking.
The error is abou unresolved external variable. When I looked the
variable I find there's nothing wrong (I guess ^_^). It's stated in
CALL and SUBROUTINE as an argument, and they were in same type and
size.
Anyone has a clue what's going on?
Thanks

Bowo

Arjen Markus

2006-01-26, 3:59 am

Can you show us some code? It may be that the subroutine is "invisible"
- for instance it is in a modue that you do not use or it is defined as
private.

Another thing: when the subroutine is in a separate object-file, you
need to specify that file on the command-line too.

The _ is a typical decoration added by the compiler. You should not
worry about it.

Regards,

Arjen

Jugoslav Dujic

2006-01-26, 3:59 am

bowo wrote:
| Hi all,
| My program was compiled, and theres no error when compiling, only 2
| warnings. The warning was about implicit statement that already been
| defined.
| I think that shouldn't stop me from building an executable file, but
| when I bulit it the compiler said that there's an error when linking.
| The error is abou unresolved external variable. When I looked the
| variable I find there's nothing wrong (I guess ^_^). It's stated in
| CALL and SUBROUTINE as an argument, and they were in same type and
| size.
| Anyone has a clue what's going on?
| Thanks

Please show us the exact error message.

It's not 100% clear from your post whether the linker complains about
a subroutine or an array -- it looks like the latter. If that's the
case, if I assume that:

1) you use Digital/Compaq Visual Fortran
2) The error message is like:
LNK2001: Unresolved external symbol _FOO@4

That means that in code, symbol "Foo" is used as an array, but compiler
cannot find an appropriate declaration that it's an array, for example:

REAL FOO
....
CALL Sub(...,Foo(1),...)

It also might happen that the array dimension got truncated beyond column
72 (assuming fixed-form source), like:

REAL Bar, Baz, ....Boo, Foo (42)
|col 72

--
Jugoslav
___________
www.xeffort.com

Please reply to the newsgroup.
You can find my real e-mail on my home page above.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com