title: How do I connect to an sqlite database in C++ using visual studio 2017 on Windows?
body: <p>I am fairly new to Windows development and C++. In trying to connect to an sqlite database, I've written the following snippet.</p>
  
  <pre><code>#include "stdafx.h"
  #include "sqlite3.h"
  
  int main()
  {
      sqlite3* db;
  
      if (sqlite3_open(&lt;path to db&gt;, &amp;db) != SQLITE_OK) {
          printf("ERROR: can't open database: %s\n", sqlite3_errmsg(db));
      }
      else { printf("Connection Successful"); }
  
      sqlite3_close(db);
  
      return 0;
  }
  </code></pre>
  
  <p>I downloaded the Universal Windows Platform VSIX package from <a href="http://www.sqlite.org/download.html" rel="nofollow noreferrer">http://www.sqlite.org/download.html</a>, which included a sqlite3.lib file and a sqlite3.dll. In Microsoft Visual Studio 2017, I have included the sqlite3.lib file and directories and copied the sqlite3.dll to the project directory.</p>
  
  <p>I should note the included sqlite3.lib is the x86 version. Trying to include the x64 version causes a build error with the '#include "sqlite3.h"' statement. I'd like to know why that's the case, but I can live with 32-bit for now.</p>
  
  <p>Running the code as is yields the following error at runtime: "The code execution cannot proceed because VCRUNTIME140_APP.dll was not found..."</p>
  
  <p><a href="https://stackoverflow.com/questions/49641364/vcruntime140-app-dll-not-included-in-the-microsoft-visual-c-2017-redistributab">This link</a> suggests that the dll should have been included with the visual studio install. The mentioned dll file does exist in C:\Program Files (x86) in several places including the Microsoft SDKs folder, under which the .lib file resides. Why may it not be found?</p>