Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29277 Discussions

Unresolved symbol __iob, ___argc, ___argv in libifcoremt.lib in mixed language programming

Kam_H_
Beginner
1,128 Views

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.

0 Kudos
4 Replies
Steven_L_Intel1
Employee
1,128 Views
You should not "exclue the LIBCMTD.lib" - that is the wrong solution to the conflict problem and creates the issue you raise here. Instead, make sure that the Fortran and C++ projects have the SAME setting for run-time library. Either both Multithreaded DLL or both Multithreaded. The Fortran and C++ defaults, nowadays, are different (Visual C++ changed to default to using the DLL libraries.)
0 Kudos
Kam_H_
Beginner
1,128 Views

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.

0 Kudos
TimP
Honored Contributor III
1,128 Views

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.

0 Kudos
Kam_H_
Beginner
1,128 Views

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.

0 Kudos
Reply