-1

Here I asked that I get LNK2001 error when I build my Visual C++ code through 'Release Mode', even though all my configuration settings between 'Release' and 'Debug' modes are the same (at least the ones I changed have been changed via 'all configurations').

I could solve the problem by changing Release mode: Configuration Properties -> C/C++ -> Code Generation -> Runtime Library from 'Multi-threaded DLL (/MD)' to 'Multi-threaded Debug DLL (/MDd)'. What does this tell me? Is what I did something odd (to take runtime library of Release from Debug)? Or does this imply that my 'Release' configurations are wrong?

  • 1
    *What does this tell me?* -- Your build is not correct. First, there is no way you could legally redistribute the program in full, since you're linking the Debug DLL, and that DLL is proprietary (not a redistributable as specified by Microsoft). Maybe one or more of your modules you're building is relying on the Debug DLL? – PaulMcKenzie Feb 12 '20 at 15:18
  • @PaulMcKenzie Thanks for your answer! I am trying to find the main reason why I can't build in the Release mode. An external Library I am using is making trouble. Can it be because the library is with license? But then why does it work with Debug DLL... This kills me, took more than 2 hours now. – independentvariable Feb 12 '20 at 15:20

1 Answers1

1

I suggest you could refer to the Linker Tools Error LNK2001

If you link to the release mode libraries when building a debug version of an application. Similarly, if you use options /MTd or /MDd or define _DEBUG and then link to the release libraries, you should expect many potential unresolved externals, among other problems. Linking a release mode build with the debug libraries also causes similar problems. To fix this issue, make sure you use the debug libraries in your debug builds, and retail libraries in your retail builds.

As far as I'm concerned, you are linking the Debug DLL in release mode. You should make sure you use the debug libraries in your debug builds, and retail libraries in your retail builds.

Jeaninez - MSFT
  • 3,210
  • 1
  • 5
  • 20