dimba
dimba

Reputation: 27631

Visual Studio C++ 2008 linking question

My project has a bunch a solutions containing several projects. There're 2 Configurations:

We have a 3rd party library. Should we have 2 version of it for each Configuration (Release version compiled with /MT and Debug version compiled with /MTd) or it's enough to have one version (/MT or /MTd)?

Thanks Dima

Upvotes: 2

Views: 170

Answers (1)

Martin v. Löwis
Martin v. Löwis

Reputation: 127527

In general, you'll need to have two versions of that external library also, and consistenly compile everything for debug or for release. The problem is that mixing different C runtimes (CRTs, e.g. debug and release CRT) can cause crashes.

There is one exception where you can get away with a release version only: if the external library is a DLL, and if you don't pass any CRT objects from one CRT to the other, the restriction does not apply.

CRT objects are FILE pointers, malloc blocks (only if one library allocates, and the other releases), the notion of a current locale, and the notion of timezone.

Upvotes: 6

Related Questions