- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
I have a fortran source code. The source cpde is using PETSc packge libraries written and comiled in C (http://www.mcs.anl.gov/petsc/).
I am trying to compile the code and i get the following linking error:
I have a fortran source code. The source cpde is using PETSc packge libraries written and comiled in C (http://www.mcs.anl.gov/petsc/).
I am trying to compile the code and i get the following linking error:
Link: executing 'link' LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library libifcoremt.lib(for_main.obj) : error LNK2019: unresolved external symbol _MAIN__ referenced in function _main Debug\\CFMC.exe : fatal error LNK1120: 1 unresolved externalsMy compiler setting is: /nologo /debug:full /Od /fpp /I"C:\\cygwin\\home\\prasouli\\petsc\\include" /I"C:\\cygwin\\home\\prasouli\\petsc\\arch-mswin-c-debug\\include" /I"C:\\Program Files (x86)\\MPICH2\\include" /gen-interfaces /Qsave /Qzero /module:"Debug\\\\" /object:"Debug\\\\" /traceback /libs:static /threads /dbglibs /c and for linking: /OUT:"Debug\\CFMC.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\\cygwin\\home\\prasouli\\petsc\\arch-mswin-c-debug\\lib" /LIBPATH:"C:\\Program Files (x86)\\MPICH2\\lib" /MANIFEST /MANIFESTFILE:"D:\\CFMC\\CFMC\\CFMC\\debug\\cf_2011.exe.intermediate.manifest" /DEBUG /PDB:"D:\\CFMC\\CFMC\\CFMC\\debug\\cf_2011.pdb" /SUBSYSTEM:CONSOLE /IMPLIB:"D:\\CFMC\\CFMC\\CFMC\\debug\\cf_2011.lib" ws2_32.lib kernel32.lib user32.lib gdi32.lib advapi32.lib libpetsc.lib libfblas.lib libflapack.lib fmpich2.lib fmpich2g.lib fmpich2s.lib mpi.lib
I am using VC2005 and Intel® Fortran 11.0.066 [IA-32].
Many thanks for any help!!!
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have (at least) two problems. The LNK4098 is due to conflicting settings for the run-time library type between the Fortran and C code. You can probably fix this by changing the setting for Fortran > Libraries > Run-Time Libraries to "Multithread DLL".
The LNK2019 error is that you do not have a main program in your Fortran code.
The LNK2019 error is that you do not have a main program in your Fortran code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Steve for the reply.
I fixed one part of the problem. It seemed that I accidentaly removed the main program from the project. I added the main program, It compiled and run but when I change run time library from multithread to multithread DLL then I get lots of compile errors:
I fixed one part of the problem. It seemed that I accidentaly removed the main program from the project. I added the main program, It compiled and run but when I change run time library from multithread to multithread DLL then I get lots of compile errors:
LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(setlocal.obj) : error LNK2005: __configthreadlocale already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(tidtable.obj) : error LNK2005: __decode_pointer already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(dosmap.obj) : error LNK2005: __errno already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(crt0dat.obj) : error LNK2005: __exit already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(crt0dat.obj) : error LNK2005: __cexit already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(printf.obj) : error LNK2005: _printf already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(mlock.obj) : error LNK2005: __unlock already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(mlock.obj) : error LNK2005: __lock already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(crt0.obj) : error LNK2005: _mainCRTStartup already defined in MSVCRTD.lib(crtexe.obj) LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRTD.lib(cinitexe.obj) LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in MSVCRTD.lib(cinitexe.obj) LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in MSVCRTD.lib(cinitexe.obj) LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in MSVCRTD.lib(cinitexe.obj) LIBCMT.lib(winsig.obj) : error LNK2005: _signal already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(calloc.obj) : error LNK2005: _calloc already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(realloc.obj) : error LNK2005: _realloc already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(_file.obj) : error LNK2005: ___iob_func already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(atox.obj) : error LNK2005: _atoi already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(errmode.obj) : error LNK2005: ___set_app_type already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(_ctype.obj) : error LNK2005: _isalpha already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(_ctype.obj) : error LNK2005: _isalnum already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(fflush.obj) : error LNK2005: _fflush already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMT.lib(getenv.obj) : error LNK2005: _getenv already defined in MSVCRTD.lib(MSVCR80D.dll) libifcoremt.lib(for_reentrancy.obj) : error LNK2005: _for_set_reentrancy already defined in libifcoremdd.lib(libifcoremdd.dll) libifcoremt.lib(for_vm.obj) : error LNK2005: _for_check_mult_overflow already defined in libifcoremdd.lib(libifcoremdd.dll) libifcoremt.lib(for_vm.obj) : error LNK2005: _for_dealloc_allocatable already defined in libifcoremdd.lib(libifcoremdd.dll) libifcoremt.lib(for_vm.obj) : error LNK2005: _for_alloc_allocatable already defined in libifcoremdd.lib(libifcoremdd.dll) libifcoremt.lib(for_close.obj) : error LNK2005: _for_close already defined in libifcoremdd.lib(libifcoremdd.dll) libifcoremt.lib(for_open.obj) : error LNK2005: _for_open already defined in libifcoremdd.lib(libifcoremdd.dll) libifcoremt.lib(for_wseq.obj) : error LNK2005: _for_write_seq already defined in libifcoremdd.lib(libifcoremdd.dll) libifcoremt.lib(for_wseq.obj) : error LNK2005: _for_write_seq_xmit already defined in libifcoremdd.lib(libifcoremdd.dll) LIBCMT.lib(vsnprint.obj) : error LNK2005: __vsnprintf already defined in MSVCRTD.lib(MSVCR80D.dll) LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
The executable of the application that I try to build is using libiomp5md.dll; do I need put this dll file in dedug folder when I compile the application.
Or do I need specify it in compiler setting in some way?
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have some part of your project referencing LIBCMT.LIB (the non-debug static multithread library) and another part referencing the Debug DLL libraries. It looks to me as if you set your Debug configuration to use the Debug DLL libraries, which will give you these errors. But you have a third option being selected by yet another set of objects or library being linked in.
I thik what I would suggest is to set the Fortran > Library > Runtime Library option to "Multithreaded" (not Debug Multithreaded) and see whast you get.
libiomp5md.dll is the OpenMP support. It is automatically added to PATH when you install the compiler. If you copy the application to another system, you need to install the Intel redistributables there (you can download them from the Intel Registration Center where you get the compiler), or just place this DLL in the same folder as your EXE.
I thik what I would suggest is to set the Fortran > Library > Runtime Library option to "Multithreaded" (not Debug Multithreaded) and see whast you get.
libiomp5md.dll is the OpenMP support. It is automatically added to PATH when you install the compiler. If you copy the application to another system, you need to install the Intel redistributables there (you can download them from the Intel Registration Center where you get the compiler), or just place this DLL in the same folder as your EXE.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much for the explanation. I changed it to "Multithreaded" and there is no warning anymore.
Do I need "Debug Multithreaded" for debuging? Because I still can debug with "Multithreaded".
cheers
Do I need "Debug Multithreaded" for debuging? Because I still can debug with "Multithreaded".
cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, you do not need "Debug Multithread" for debugging. If you choose "Debug Multithread" you get the added ability to debug some of the Microsoft C run-time library and get some additional heap and stack checking provided by that library.

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