title: C++ - Qt + v8 under msvc2012
body: <p>Recently, I've started a project under <em>Qt5.1.0</em>.<br>
  After some development, I choose to make a scripting system under <em>Javascript</em> with <em>Google V8</em>.<br>
  Under <em>Windows 7 x64</em>, the only way to compile <em>V8</em> is under <em>msvc2012</em>, and I got 3 .lib files to use.<br>
  In a single project <strong>using ONLY V8</strong>, everything works well. But integrating V8 with an existent project using Qt5 it's a bit more complicated.  </p>
  
  <p>Here is an example of a minimal code I'm using : (Of course, there is more file in this project...)</p>
  
  <pre><code>#include &lt;QApplication&gt;
  
  #include &lt;v8.h&gt;
  
  using namespace v8;
  
  int v8_test() {
    Isolate* isolate = Isolate::GetCurrent();
    HandleScope handle_scope(isolate);
    Handle&lt;Context&gt; context = Context::New(isolate);
    Persistent&lt;Context&gt; persistent_context(isolate, context);
    Context::Scope context_scope(context);
    Handle&lt;String&gt; source = String::New("'Hello' + ', World!'");
    Handle&lt;Script&gt; script = Script::Compile(source);
    Handle&lt;Value&gt; result = script-&gt;Run();
    persistent_context.Dispose();
    String::AsciiValue ascii(result);
    printf("%s\n", *ascii);
    return 0;
  }
  
  int main(int ac, char **av)
  {
      std::cout&lt;&lt;"Starting application"&lt;&lt;std::endl;
      QApplication app(ac, av);
  
      v8_test();
  
      //Do something else
  
      return app.exec();
  }
  </code></pre>
  
  <p>At this point, I got a lot of linking errors of this type :</p>
  
  <pre><code>1&gt;v8_base.x64.lib(api.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in moc_aCertainFile.obj
  1&gt;v8_base.x64.lib(v8threads.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in moc_aCertainFile.obj
  1&gt;v8_base.x64.lib(checks.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in moc_aCertainFile.obj
  </code></pre>
  
  <p>It seems that Qt was compiled with <code>/MDd</code> flag, and V8 can only be compiled <code>/MTd</code> flag.</p>
  
  <p>After lot of research and testing, I was unable to find anything...<br>
  Anyone got a clue to resolve this problem?  </p>
  
  <p>Thanks in advance.</p>