I am using Visual C ++ 2008 SP1. I have an application that compiled in debug mode, but links to the library in release mode.
I get crash on application launch. To reduce the problem, I created a simple solution with two projects:
- lib_release (generates .lib, in release mode)
- exec_using_lib_release (genereates.exe, in debug mode)
The lib_release project is simple enough to have a simple class:
//Foo.h #include <vector> class Foo { std::vector<int> v; public: void doSomething(); }; //Foo.cpp #include "Foo.h" void Foo::doSomething() {}
The exec_using_lib_release project is simple:
//main.cpp
And it crashes, this is the same problem that is reported How do you create debug.exe (MSVCRTD.lib) against the released lib (MSVCRT.lib)? but his answer did not help me.
I get the same linker warnings, I tried the same steps, but no one worked. Is something missing?
EDIT:
In lib_release (which creates the library in release mode) I use Multi Threaded (/ MT), and in exec_using_lib_release I use Multi Threaded Debug (/ MTd). I think this is the expected way to do this, since I want .lib to be created without debugging information. I read the document in the MSDN Runtime library , and these are the settings for linking to a CRT in a static way.
I do not have "Common Language Runtime Support".
c ++ visual-studio-2008 visual-studio linker
Edison Gustavo Muenz
source share