title: How to build MySQL connector c++ with VS 2010 on a Windows x64 machine?
body: <p>It seems to be a PITA to get what I want: a working MySQL Connector/C++ on a Windows x64 machine.</p>
  
  <p>What I already tried:</p>
  
  <ul>
  <li>I first tried the binary packages on the MySQL download site, where I had to add a missing include-file (sqlstring.h) from some other place (see <a href="http://forums.mysql.com/read.php?167,387820,387820" rel="nofollow">here</a>)</li>
  <li>Then my test code compiled, but didn't run because a libmysql.dll was missing (again not included in the binary package)</li>
  <li>I found out that the Connector/C package contained this dll, so I took it from there. Now, my Connector is working fine... in Debug mode. But really strange things happen when I'm in Release mode. Sometimes the application quits without any warning when trying to connect. Sometimes it tells me I have a SQL syntax error in my very simple statement (<code>SELECT * FROM sometable</code>), which works fine in Debug mode.</li>
  <li>I then found out <a href="http://dev.mysql.com/downloads/connector/cpp/" rel="nofollow">here</a> that it is preferrable to build the connector from source, so I tried that. The C++ connector needs the C-connector and after some trouble (I had to patch a CMakeFile.txt because of this <a href="http://bugs.mysql.com/bug.php?id=45843" rel="nofollow">bug</a>) I managed to build the C connector.</li>
  <li>I also managed to generate a VS solution with CMake for the C++ connector, but now I'm stuck. There's too many build errors because of some missing include files... I don't know if it's my CMake configuration or if it's not working with VS2010 or if it's just buggy.</li>
  </ul>
  
  <p>Is it so unusual to use the MySQL C++ connector (built with VS2010) on a Win x64 machine?
  There must be an easier way to get it working, right?</p>
  
  <p>I'd be grateful for any hints.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I think I should be more precise on my build errors:</p>
  
  <p>First, I added</p>
  
  <pre><code>&lt;path_to_mysql_connector_cpp_build&gt;
  &lt;path_to_mysql_connector_cpp_build&gt;\cppconn
  &lt;path_to_mysql_connector_cpp_build&gt;\driver\nativeapi
  </code></pre>
  
  <p>to the <code>mysqlcppconn</code> and <code>mysqlcppconn-static</code> project include directories in order to find the <code>config.h</code> , the <code>cppconn/config.h</code> and the <code>driver/nativeapi/binding_config.h</code> include files.</p>
  
  <p>But now, some <code>my_global.h</code> file is missing and I can't find it. It seems to be within the include files for the MySQL server, but I thought that the server wasn't needed for the connector.</p>
  
  <p>And I just found a comment <a href="http://dev.mysql.com/doc/refman/5.1/en/connector-cpp-apps-windows-visual-studio.html" rel="nofollow">here</a>, stating that the C++ connector isn't compatible with VS2010 yet (that was in october 2011).</p>
  
  <p>So what can I do if the prebuilt binaries from the MySQL download site aren't working properly?</p>