Mixing debug and release runtime libraries

When linking with jpeg.lib, link time code generation must be turned on as jpeg.lib was generated with /GL enabled (it’s a release build), which in turn disables incremental linking, which may increase linking time and likely cause a crash during the command line debug build using msbuild.

See the warnings below:

jpeg.lib(jdapimin.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

Both options are reflected to the corresponding settings now: /LTCG and /INCREMENTAL:NO.
And additionally /NODEFAULTLIB:MSVCRT is used with the linker as the jpeg.lib and libpng15.lib were previously linked (by /MD option) with the release version runtime (MSVCRT.LIB) whereas the project will be linked (by /MDd option) with debug version runtime (MSVCRTD.LIB) in debug build. The option enforces to ignore MSVCRT.LIB and to use MSVCRTD.LIB only.

Referred to this forum.

Mixing debug and release runtime libraries

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s