- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would like to call a Fortran subroutine from a C++ code function.
I have two projects in one solution. The project with C++ code calls a Fortan subroutine. The Fortran project is set up to compile as a static library.
(1) Project with C++ code (test-Q.cpp)
(2) Project with Fortran code (getqpf.F)
At the top of my C++ code file, I've placed:
extern"C" {
void getqpf (double *tri);
}
However, when trying to call the Fortran subroutine from code in the C++ file, I get the following linker error:
1>test-Q.obj : error LNK2019: unresolved external symbol _getqpf referenced in function "void __cdecl call_function(class std::vector<double,class std::allocator<double> >)" (?call_function@@YAXV?$vector@NV?$allocator@N@std@@@std@@@Z)
1>E:\DEVELOPMENT-FINAL\EXPERIMENTS\test-Q-analysis-1\fortran_code\Debug\C-drivers.exe : fatal error LNK1120: 1 unresolved externals
What is the proper way for C++ code to call Fortran code? Is there a name-mangling convention used when calling Fortran code from C++ code?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page