Visual Studio C ++ Linker Warning: LNK4006 with C Run-Time (CRT)

I am going to ask this question, and then answer it myself. I know this is a newbie question, but since it took me approx. two days to find the right answer, I will send it anyway.

So much for failures - this one is dedicated to all of you newbies:

I went to the MFC project in VS 2010, and I needed to add some third-party static library. Everything went well, both projects were compiled, and my project managed to access the library. Then, when I included some header file from the library in my project, I got a lot of warnings about linkers, about functions in the C runtime library, for example:

Warning 9 warning LNK4006: _sprintf is already defined in libcmtd.lib (sprintf.obj); the second definition is ignored. C: path \ to \ my \ project \ MSVCRTD.lib (MSVCR100D.dll)

I think, β€œhell”, I tried to launch my project, and it started until I came across a line of code that I tried to write to some file using β€œfostream”, and then it crashed with some terrible heap exception.

Searching SO, I ran into some related issues, none of which exactly matched my problem:

I almost wrapped the external library in the dll before I came across an answer.

+3
source share
1

, Microsoft: C Run-Time (CRT).

-, , articel:

CRT , , .

, (CRT) . CRT VS 2010 : click-click project_name β†’ ( ) β†’ C/++ β†’ β†’ . (, , ).

, () .

+5

Source: https://habr.com/ru/post/1776045/


All Articles