title: Linking against library in release and .exe in debug crashes in Visual studio
body: <p>I'm using Visual C++ 2008 SP1. I have an app that is compiled in debug mode, but links against a library in release mode.</p>
  
  <p>I'm getting a crash at the start-up of the application. To make the problem smaller, I created a simple solution with 2 projects:</p>
  
  <ul>
  <li>lib_release (generates a .lib, in release mode)</li>
  <li>exec_using_lib_release (genereates a .exe, in debug mode)</li>
  </ul>
  
  <p>The 'lib_release' project is simple enough to have a simple class:</p>
  
  <pre><code>//Foo.h
  #include &lt;vector&gt;
  class Foo {
    std::vector&lt;int&gt; v;
    public:
    void doSomething();
  };
  //Foo.cpp
  #include "Foo.h"
  void Foo::doSomething() {}
  </code></pre>
  
  <p>The 'exec_using_lib_release' project is simple like this:</p>
  
  <pre><code>//main.cpp
  #include "Foo.h"
  int main() {
     Foo foo;
     foo.doSomething();
     return 0;
  }
  </code></pre>
  
  <p>And it crashes, it's the same problem reported by <a href="https://stackoverflow.com/questions/746298/how-do-you-build-a-debug-exe-msvcrtd-lib-against-a-release-built-lib-msvcrt-l">How do you build a debug .exe (MSVCRTD.lib) against a release built lib (MSVCRT.lib)?</a>, but his answer didn't work for me.</p>
  
  <p>I get the same linker warnings, I tried the same steps, but none worked. Is there something I'm missing?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>On the lib_release (that creates a library in release mode), I'm using <em>Multi Threaded (/MT)</em>, and at the exec_using_lib_release, I'm using <em>Multi Threaded Debug (/MTd)</em>. I think this is the expected way of doing it, since I want the .lib to be created without debug info. I read the document at <a href="http://msdn.microsoft.com/en-us/library/abx4dbyh(VS.80).aspx" rel="nofollow noreferrer" title="MSDN - Runtime library">MSDN Runtime library</a> and those are the settings of linking against the CRT in a static way.</p>
  
  <p>I don't have 'Common Language Runtime Support' either.</p>