- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am working with Intel Visual Fortran 9.0. I am retrying to build a C++ application in Visual Studio 2003 that calls a Fortran function from a library I have created. I want to call for_rtl_init from the C code to establish the error handlers. Everything compiles OK, but I get the following linker errors
Linking...
mainApp.obj : error LNK2019: unresolved external symbol "int __cdecl for_rtl_finish_(void)" (?for_rtl_finish_@@YAHXZ) referenced in function __catch$_WinMain@16$0
mainApp.obj : error LNK2019: unresolved external symbol "void __cdecl for_rtl_init_(int *,char * *)" (?for_rtl_init_@@YAXPAHPAPAD@Z) referenced in function _WinMain@16
Debug/mainApp.exe : fatal error LNK1120: 2 unresolved externals
My code, more or less, is:
void for_rtl_init_(int *, char **);
int for_rtl_finish_();
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR Args, int WinMode)
{
// parse command line
for_rtl_init_(&argc, argv);
rv = fortran_func( );
// process lots of return values
io_status = for_rtl_finish_();
}
I have included libifcoremt in my C project dependencies and have the fortran lib directory in my search path, but the linker doesn't find these functions. Can anyone who has use for_rtl_int() from C give me some advice?
Linking...
mainApp.obj : error LNK2019: unresolved external symbol "int __cdecl for_rtl_finish_(void)" (?for_rtl_finish_@@YAHXZ) referenced in function __catch$_WinMain@16$0
mainApp.obj : error LNK2019: unresolved external symbol "void __cdecl for_rtl_init_(int *,char * *)" (?for_rtl_init_@@YAXPAHPAPAD@Z) referenced in function _WinMain@16
Debug/mainApp.exe : fatal error LNK1120: 2 unresolved externals
My code, more or less, is:
void for_rtl_init_(int *, char **);
int for_rtl_finish_();
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR Args, int WinMode)
{
// parse command line
for_rtl_init_(&argc, argv);
rv = fortran_func( );
// process lots of return values
io_status = for_rtl_finish_();
}
I have included libifcoremt in my C project dependencies and have the fortran lib directory in my search path, but the linker doesn't find these functions. Can anyone who has use for_rtl_int() from C give me some advice?
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For C++, you need extern "C" in front of those for_rtl_xxx declarations.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That was it. Thanks.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page