error building Windows External (LNK2005:) LIBCMTD.lib (sprintf.obj)


    Jul 18 2013 | 6:46 am
    Hello,
    I'm running into an error building a Windows external with SDK 6.1.1--worked fine with SDK 5.
    When I build, I get the error "error LNK2005: _sprintf already defined in MaxAPI.lib(MaxAPI.dll) C:\\Users\\Administrator\\Desktop\\MaxSDK-6.1.1\\examples\\advanced\\my_object_name\\LIBCMTD.lib(sprintf.obj)"
    I'm defining anywhere in my code. It seems like it's being defined in the MaxAPI.dll and also the LIBCMTD.lib, but I have no idea what/where that is. I've searched for the file and searched hidden as well as sprintf.obj, but I can't find it.
    Any insight would be great lest I decide to release the 64-bit version of this object as "Mac only" :) Thanks.

    • Jul 19 2013 | 5:58 am
      Nevermind :)
    • Jul 19 2013 | 1:55 pm
      Hi,
      You should ignore the default library libcmt.lib and perhaps msvcrt.lib too. For Visual Studio, try this :
      - project properties -> Linker -> Ignore all default libraries : no
      - project properties -> Linker -> Ignore specific library : libcmt.lib; msvcrt.lib;
      - project properties -> C/C++ -> Runtime libary : Multithread (/MT)
      Cheers
    • Aug 01 2013 | 3:14 am
      Thx Pierre, solved my problem too :)
    • Aug 14 2015 | 4:09 pm
      An alternative is try /MT but don't ignore the libraries libcmt and mscvrt. for debug option, use /MDd for now (at least I couldn't get /MTd working without it messing sprintf).