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.
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:
- lib_release (generates a .lib, in release mode)
- exec_using_lib_release (genereates a .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 like this:
//main.cpp
#include "Foo.h"
int main() {
Foo foo;
foo.doSomething();
return 0;
}
And it crashes, it's the same problem reported by http://stackoverflow.com/questions/746298/how-do-you-build-a-debug-exe-msvcrtd-lib-against-a-release-built-lib-msvcrt-l, but his answer didn't work for me.
I get the same linker warnings, I tried the same steps, but none worked. Is there something I'm missing?
EDIT:
On the lib_release (that creates a library in release mode), I'm using Multi Threaded (/MT), and at the exec_using_lib_release, I'm using Multi Threaded Debug (/MTd). 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 MSDN Runtime library and those are the settings of linking against the CRT in a static way.
I don't have 'Common Language Runtime Support' either.