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

V.J.'s icon

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.

V.J.'s icon

Nevermind :)

Pierre Guillot's icon

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

FineCutBodies's icon

Thx Pierre, solved my problem too :)

Venetian's icon

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).