How to tell if a lib was compiled with /mt or /md?

Yes, you could use dumpbin’s /DIRECTIVES option to find which runtime libraries the objects in the .lib want to link with:

dumpbin /directives foo.lib

Look for instances of the runtime libraries specified here. For example, you might see:

/DEFAULTLIB:MSVCRTD (module compiled with /MDd)

or

/DEFAULTLIB:MSVCRT (module compiled with /MD)

or

/DEFAULTLIB:LIBCMT (module compiled with /MT)

There will probably be many /DEFAULTLIB directives, so you can search using terms like:

dumpbin /DIRECTIVES foo.lib | find /i "msvcr"

Leave a Comment