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

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

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.


2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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.

Leave a Comment

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