0

I'm working on a project using OpenGL. However, I have the linker warning "Resolving LNK4098: defaultlib 'MSVCRT' conflicts with ..." when I build my project.

I've been reading a lot of stuff about this warning, and found out using Dependency Walker that my GLEW is using MSVCRT.dll (I think that's how it's supposed to be, since that's the "default lib"). However, when I inspect GLFW3.DLL it says it uses MSVCR120.DLL, the wrong dll which I suspect to cause the conflict in my application.

So I try to build GLFW from scratch with the source code from the website. I edited the following settings in the project:

  • Target Extension -> first I build the .lib, then the .dll
  • Platform Toolset -> v120
  • Configuration type -> first I build the .lib, then the .dll

And then under C/C++ -> Code Generation -> Runtime Library I select Multi-threaded DLL (/MD)

Before I compile I put everything on "release".

When I rebuild everything and inspect it again, It still says it's using MSVCR120.dll and it still causes the well known LNK4098 conflict. What am I doing wrong here? How can I resolve the conflict? Thanks in advance!

Markinson
  • 2,077
  • 4
  • 28
  • 56

1 Answers1

2

You need to use the same "Runtime Library" setting for the library and your application.

To avoid problems, you should prepare two builds of the library: one for debug and one for release.

Azarien
  • 159
  • 3
  • Trying that right now, I'll let you know if it worked – Markinson Mar 02 '16 at 13:40
  • Thank you so much :) It's working without warning now! I built all my packages as 'release' using /MD settings, and put the project itself on release as well and now the warnings are gone. However, the one dll still displays MSVCR120 while the other displays MSVCRT. Any explanation for that? Link: http://bit.ly/1QmsXA0 – Markinson Mar 02 '16 at 13:51