error LNK2019: Why I can not use "function" in my module?

error LNK2019: Why I can not use "function" in my module?

Bild des Benutzers lyricx

I am using Intel(R) Visual Fortran Composer XE 2011 Integration for Microsoft Visual Studio* 2010,   In my fortran code, the encountered problem is that I can not use "function" in my module, currently I just change the "function" to "subroutine" to simply abviate this problem.

When I use function in my code, I always meet with the error " error LNK2019 ".

Can anyone tell me how to resolve this problem? Thank you very much!

For the attached file, I can't compile successfully.

lyricx

2 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.
Bild des Benutzers mecej4

Your description of the problem is rather vague, but here is what I guess to be the problem.

You declare a function in one module, and invoke that function in a different subprogram which does not have a USE ... statement for the first module.

Functions declared in a module receive name decorations, which explains the linker error that is issued when the invocation uses the undecorated name of the function. Rather than taking the trouble to learn and use the decoration scheme, you will do better if you employ an appropriate USE statement.

Melden Sie sich an, um einen Kommentar zu hinterlassen.