title: Visual C++ code not working in Code::Blocks
body: <p>I have the following code that I am currently using to call functions from a C# Dll, which works perfectly in Visual C++.</p>
  
  <pre><code>#include &lt;mscoree.h&gt;
  #include &lt;stdio.h&gt;
  #pragma comment(lib, "mscoree.lib") 
  
  void Bootstrap()
  {
      ICLRRuntimeHost *pHost = NULL;
      HRESULT hr = CorBindToRuntimeEx(L"v4.0.30319", L"wks", 0, CLSID_CLRRuntimeHost, IID_ICLRRuntimeHost, (PVOID*)&amp;pHost);
      pHost-&gt;Start();
      printf("HRESULT:%x\n", hr);
  
      // target method MUST be static int method(string arg)
      DWORD dwRet = 0;
      hr = pHost-&gt;ExecuteInDefaultAppDomain(L"c:\\temp\\test.dll", L"Test.Hello", L"SayHello", L"Person!", &amp;dwRet);
      printf("HRESULT:%x\n", hr);
  
      hr = pHost-&gt;Stop();
      printf("HRESULT:%x\n", hr);
  
      pHost-&gt;Release();
  }
  
  int main()
  {
      Bootstrap();
  }
  </code></pre>
  
  <p>The problem is, when I move this into Code::Blocks (which I am more familiar with - as the little C++ I have done has been native) throws a lot of compiler errors.</p>
  
  <p>The original compiler errors were because it couldn't find the header <code>mscoree.h</code>. I found this in the .NET SDK, so I copied it over to the mingw include directory which solved that, and then I did the same for all the other headers it couldn't find.</p>
  
  <p>After copying over all the headers it then started giving a whole load of other errors, to do with the code in the headers I had just moved - nothing to do with the code below.</p>
  
  <p>Why is Code::Blocks having such a hard time running this when VS runs it straight off the bat?</p>
  
  <p>Thanks</p>