C.J.
C.J.

Reputation: 16091

Ignore specific libraries for crt libraries?

In a very old code base, we have some build settings for our visual C++ project settings that are confusing and seemingly not necessary.

Our C++ projects are built with visual studio (Currently using vs 2010) and in the linker options there are a few libraries specified for the 'ignore specific libraries' linker setting. Some of these libraries are: msvcirt.lib and msvcrtd.lib.

So for the question: I can't figure out for the life of me why ignoring these specific libraries would be necessary?

My best guess is that: Perhaps it was necessary back in the early days of visual studio? ... for some weird reason known only to the folks who put it in.

By default, using VS 2010 to make a C/C++ project (i.e. .vcxproj) those libraries are not specifically ignored. Therefore I'm 99% sure that this linker setting is not necessary 99% of the time. Does anyone agree with me in this?

When I use dependency walker to inspect any old DLL that I build, I can see that if I link in ADVAPI32.dll that it was a dependency on msvcrt.dll. But that should really be none of my concern...

Upvotes: 4

Views: 3260

Answers (2)

fiscblog
fiscblog

Reputation: 694

It is even getting worse. The libraries you have to ignore depend on those you are actually using.(If you don't you could end up in huge trouble like heap corruptions etc.)

So given the characteristics of your project (MultiThreaded, SingleThreaded,..) you would have to use specific Runtime Libraries. Have a look here for an overview which Runtime Library to use.

And given the Runtime Libraries you are using you have to ignore others then. Have a look here for an overview which Library to ignore.

Upvotes: 2

Yochai Timmer
Yochai Timmer

Reputation: 49251

There are situation where there are conflicts in core libraries when you link multiple libraries that were compiled differently.

I've encountered some problems where i had to use that when compiling C++/CLI with the /clr flag.

A few examples:

Difficulty Building with Visual Studio 2010

Visual Studio .NET 2003 - Ignore Specific Library for libcmt vs libcmtd

Upvotes: 2

Related Questions