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

module's internal procedure generating unresolved external

New Contributor II

I think I'm missing something simple.  I have created a module that CONTAINS one function and two subs.  The function calls one of the subs.  The code compiles ok, but linking generates an unresolved external.

error LNK2019: unresolved external symbol _READREGVAR referenced in function _LIME_API_MOD_mp_CHECKLIMEKEY CheckLimeKey.obj

This code built and ran ok when these 3 routines were not in a Module.  What am I missing?  The source file is attached.


0 Kudos
2 Replies
Honored Contributor III

If you take a source file that contains routines that used to be EXTERNAL, and then move those routines into a module,  those routines can no longer be called from other places as if they were still EXTERNAL. In each routine that calls ReadRegVar, you must insert a USE CheckKey_mod statement in an appropriate location. 

You have shown only one source file, but the problem relates to several source files and how they are interrelated. Such fragmentary reports usually do not lead to useful advice or solutions to issues.

New Contributor II

Thanks, mecej4.  It was my dumb mistake of not reading the error message carefully enough.

0 Kudos