- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to compile a simple code to call a fortran code from c++ using Visual Studios 2005 SP1. The fortran code is set to be a static library project within a c++ solution. If I put any I/O in the fortran code, it gives me a unresolve symbol for __iob, ___argc, ___argv from the libifcoremt.lib. I'm compiling in debug mode and have to exclude the LIBCMTD.lib from my C++ solution for it to compile without getting conflicts with MSVCRTD.lib. How do I get resolve these symbols. If I remove the I/O statements such as write(*,*), the code will compile, adding write or open will produce the unresolved symbols.
Thanks.
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
I'm sort of new to this, how do I use the static version of the Fortran run-time library. I assume that Fortran is trying to link with the static library whereas the C++ project is using static libraries. Do I set the -static in the Fortran project or specifically call out the static runtime libraries in fortran. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you check the compiler docs, or look in the Visual Studio compiler properties menus, you have available the selection of /MT (static, Fortran default) or /MD (dynamic, C++ default) "release" libraries or the corresponding debug libraries.
The C++ default of /MD has proven troublesome to me in more situations than the one described here; at least under Windows 7-64/VS2005, the dynamic library sometimes fails to run even when correctly set up, unless the library is copied into the folder with the .exe. I don't know if this is among the reasons why VS2008 is recommended over 2005; I've had to keep both 2005 and 2008 installed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Much thanks, this did the trick. Too bad the fortran project can't inheret the main C++ solution runtime properties. This would solve a lot of these library conflicts.

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