title: Preprocessor makes function name unaccessabel
body: <p>I have to create a SQLite database using System.Data.SQLite and using C++/CLI but I run into problems. Unfortunately, using C# is not an option, if it was then there is no problem. (Please don't advise me not to use C++/CLI, it is not an option in this project.)</p>
  
  <p>In C# the following code works without any problem.</p>
  
  <pre><code>using System.Data.SQLite;
  
  void CreateDb(String file)
  {
      SQLiteConnection.CreateFile(file);
  }
  </code></pre>
  
  <p>The equivalent code in C++/CLI is not without its problems.</p>
  
  <pre><code>using namespace System::Data::SQLite;
  
  void CreateDb(System::String ^file)
  {
      SQLiteConnection::CreateFile(file); // error C2039
  }
  </code></pre>
  
  <p>The exact error txt for C2039 is:
  // error C2039: 'CreateFileA' : is not a member of 'System::Data::SQLite::SQLiteConnection'</p>
  
  <p>If I take a closer look at the definition of CreateFile I get the following choice</p>
  
  <pre><code>#define CreateFile CreateFileW - c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include\WinBase.h(9292)
  #define CreateFile CreateFileA - c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include\WinBase.h(9294)
  </code></pre>
  
  <p>Which leads to the following lines in WinBase.h</p>
  
  <pre><code>#ifdef UNICODE
  #define CreateFile  CreateFileW
  #else
  #define CreateFile  CreateFileA
  #endif // !UNICODE
  </code></pre>
  
  <p>The Microsoft SDK is muddling with exact the name that I need and SQLite does not provide me with CreateFile[AW] versions.
  So I tried this before the code calling SQLiteConnection.CreateFile(file) and I do this isolated so that other code is affected by it.</p>
  
  <pre><code>#ifdef CreateFile
  #undef CreateFile
  #endif
  </code></pre>
  
  <p>It solves my problem (for now) but how safe is this?</p>
  
  <p>Is there a better way of solving this problem?</p>
  
  <p>Your advise is much appreciated.</p>