I have a fortran console program which includes two sub projects in C. The program will build and run in Debug mode, but will not build in Release mode. Here are the error messages, and I've attached the build log. I have no idea what the problem is, and I'm hoping someone can tell me what I'm doing wrong. Thanks.
Warning 5 warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library LINK
Error 6 fatal error LNK1169: one or more multiply defined symbols found Release/XLTRC2.exe
Error 4 error LNK2005: _printf already defined in LIBCMT.lib(printf.obj) MSVCRT.lib(MSVCR100.dll)
Error 3 error LNK2005: _malloc already defined in LIBCMT.lib(malloc.obj) MSVCRT.lib(MSVCR100.dll)
链接已复制
Hi Brian, if the problem still exists, I would suggest without having a deeper look into the buildlog.html that you link against a mix of runtime libraries. You C-code might be linked with release dll and your Fortran code with static. You should check this in your VS release settings in comparison to the debug setting. Only a suggestion.
Best regards, Johannes
Thanks for the reply. The problem has gone away. I can now build Release without any errors. The cure might have been doing a rebuild-all, or it might been my removing the pair of C sub-projects after converting the C to fortran.
