0

When I use the /MT flag with ICC 14 I get these errors:

1>  xilink: executing 'link'
1>MSVCRT.lib(MSVCR120.dll) : error LNK2005: isspace already defined in LIBCMT.lib(_ctype.obj)
1>MSVCRT.lib(MSVCR120.dll) : error LNK2005: __iob_func already defined in LIBCMT.lib(_file.obj)
1>MSVCRT.lib(MSVCR120.dll) : error LNK2005: fprintf already defined in LIBCMT.lib(fprintf.obj)
1>MSVCRT.lib(MSVCR120.dll) : error LNK2005: abort already defined in LIBCMT.lib(abort.obj)
1>MSVCRT.lib(MSVCR120.dll) : error LNK2005: free already defined in LIBCMT.lib(free.obj)
1>MSVCRT.lib(MSVCR120.dll) : error LNK2005: malloc already defined in LIBCMT.lib(malloc.obj)
1>MSVCRT.lib(MSVCR120.dll) : error LNK2005: realloc already defined in LIBCMT.lib(realloc.obj)
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __cdecl type_info::type_info(class type_info const &)" (??0type_info@@AEAA@AEBV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __cdecl type_info::operator=(class type_info const &)" (??4type_info@@AEAAAEAV0@AEBV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>D:\forgottenserver-master\vc12\x64\Release\theforgottenserver.exe : fatal error LNK1169: one or more multiply defined symbols found

I have no idea what is causing this and when I use the /MD flag everything works fine

I'm using ICC version 14 with MSVC 2013 ultimate and I'm compiling a program for x64 with boost (I compiled those files for the iw platform myself and they appear to work)

mc110
  • 2,825
  • 5
  • 20
  • 21
dominique120
  • 1,170
  • 4
  • 18
  • 31
  • 1
    How about `use /nodefaultlib:MSVCRT`? – Jonas Bötel Jun 28 '14 at 22:21
  • 1
    You should not need to specify `/nodefaultlib:msvcrt`. If you are getting the errors you describe, it means some objects in your linker were compiled with `/MT` and others were compiled with `/MD`. You can't mix-and-match; all source files need to be compiled with the same option. – James McNellis Jun 28 '14 at 23:44
  • @JamesMcNellis How do I compile the libs that are mentioned in the error with the /MT flag? – dominique120 Jun 29 '14 at 00:32

1 Answers1

-2

Try to specify LIBCMT in Properties -> Linker -> Ignore Specific Default Libraries

grisha
  • 1,247
  • 1
  • 14
  • 20
  • 2
    Fixing multiply-defined symbol errors by ignoring them is never a good idea. The mixture of runtimes is quite likely to lead to subtle and hard-to-diagnose memory bugs. – Sneftel Jun 28 '14 at 22:38
  • I said "Try", not "You must" – grisha Jun 28 '14 at 22:47
  • 2
    If he tries it, it'll work. Then a while later, he'll get a crash when he tries to resize a vector, and he'll have no idea why. – Sneftel Jun 28 '14 at 22:48
  • this is called "experience" :) – grisha Jun 28 '14 at 22:50
  • 2
    So your plan is to willfully mislead him so that he has to struggle to figure out you were willfully misleading him, rather than just teaching him what he needs to know? That's... i dont even. – Sneftel Jun 28 '14 at 23:03
  • you have decided that my proposal is 100% wrong and that this must lead to unknown errors and so on. But it's not true. It **can** lead to such errors, but may not lead. I don't telling that you are wrong. But you should have just warn about posibility to have "hard-to-diagnose memory bugs". And you are wrong about my plan. I just telling about possible solution. And now if he will try and will have strange errors then he will know that, _maybe_, it was caused by such solution. Btw, it's works. Waiting for your errors:) – grisha Jun 28 '14 at 23:36