The attached file contains some functions and subroutines. The program works fine without putting the functions and subroutines in the module. However, when I use the module I got the following error.
1>testprog.obj : error LNK2019: unresolved external symbol _FUNC1 referenced in function _XXX_mp_ROCKPROP
1>testprog.obj : error LNK2019: unresolved external symbol _FUNC2 referenced in function _XXX_mp_ROCKPROP
1>Debug\testprog.exe : fatal error LNK1120: 2 unresolved externals
Could you please, the source of this issue?
If you wish to call subroutines and use functions that are inside a module, you have to include a USE statement for the module in your calle\ing program unit. If you do not do so, the caller will issue references to external names such as FUNC1, but the OBJ file produced from the module will have decorated names which will not match. Similarly, if you have a USE xxx statement, you should not declare FUNC1 and FUNC2 as external.
As alluded to in #2, the line "REAL(KIND=8),external :: FUNC1,FUNC2" is the problem and should be removed. In this case they are in the same module so can be automatically seen by ROCKPROP. Declaring as external is telling the compiler to look elsewhere.