- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
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.f90
1>Linking...
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?
Regards548408
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have removed the external declaration for FUNC1, FUNC2, AND FUNC. Now it is working fine.
Thanks for your enlightened replies.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page