views:

526

answers:

2

How to connect with MySQL from Visual C++ Microsoft Visual Studio 2008 ? I tried googling and found solutions all of which ended with fatal errors like linker errors,... etc. Please explain (or provide a link) step by step, including prerequisites (with links) and all details. I don't need any query examples.. just connecting to MySQL. Thanks in advance.

+1  A: 

MySQL++ supports VC++ 2008, and comes with specific documentation on how to set up your project to avoid the link errors you're seeing.

Disclosure: I'm MySQL++'s maintainer

Warren Young
A: 

This worked for me (I am using xampp):

  1. Open a C++ project (with precompiled header)
  2. Change it from Debug to Release.
  3. Install complete mysql (if you install complete mysql, a C connector will also installed as a include and lib file, which is not installed in typical installation)
  4. copy mysql/include to xampp/mysql
  5. project > project properties > configuration properties >c++ > general > additional include directory --> C /xmapp/mysql/include.
  6. Project > add existing item > lidmysql.lib (it’s found in mysql/lib/opt.)
  7. Copy libmysql.dll to c:\windows. Alternativly we can copy it to the project’s folder or we can set path environment variable. But we only tested it copy to c:\windows
mshsayem