S
als erstes solltest du immer in der ofiziellen doku schaun
http://tangentsoft.net/mysql++/doc/html/userman/incorporating.html#inc-vstudio schrieb:
9.1. Visual C++
9.1.1. Using MySQL++ in an MFC Project
If you don’t already have a project set up, open Visual Studio, say File | New | Project, then choose Visual C++ | MFC | MFC Application. Go through the wizard setting up the project as you see fit.
Once you have your project open, right click on your top-level executable in the Solution Explorer, choose Properties, and make the following changes. (Where it doesn’t specify Debug or Release, make the same change to both configurations.)
Append the following to C/C++ | General | Additional Include Directories: C:\Program Files\MySQL\MySQL Server 5.0\include, C:\mysql++\include
*
Under C/C++ | Code Generation change “Runtime Library” to “Multi-threaded Debug DLL (/MDd)” for the Debug configuration. For the Release configuration, make it “Multi-threaded DLL (/MD)”.
*
Append the following to Linker | General | Additional Library Directories for the Debug configuration: C:\Program Files\MySQL\MySQL Server 5.0\lib\debug, C:\mysql++\vc\debug
For the Release configuration, make it the same, but change the “debug” directory names to “opt”.
*
Under Linker | Input add the following to “Additional Dependencies” for the Debug configuration: libmysql.lib wsock32.lib mysqlpp_d.lib
...and then for the Release configuration: libmysql.lib wsock32.lib mysqlpp.lib
This difference is because MySQL++’s Debug DLL and import library have a _d suffix so you can have both in the same directory without conflicts.
You may want to study examples\vstudio\mfc\mfc.vcproj to see this in action. Note that some of the paths will be different, because it can use relative paths for mysqlpp.dll.
9.1.2. Using MySQL++ in a Windows Forms C++/CLI Project
Before you start work on getting MySQL++ working with your own program, you need to make some changes to the MySQL++ build settings. Open mysqlpp.sln, then right-click on the mysqlpp target and select Properties. Make the following changes for both the Debug and Release configurations:
Under Configuration Properties | General, change “Common Language Runtime support” to the /clr setting.
*
Under C/C++ | Code Generation, change “Enable C++ Exceptions” from “Yes (/EHsc)” to “Yes With SEH Exceptions (/EHa)”
If you have already built MySQL++, be sure to perform a complete rebuild after changing these options. The compiler will emit several C4835 warnings after making those changes, which are harmless when using the DLL with a C++/CLI program, but which warn of real problems when using it with unmanaged C++. This is why MySQL++’s Windows installer (install.hta) offers the option to install the CLR version into a separate directory; use it if you need both managed and unmanaged versions installed!
For the same reason, you might give some thought about where you install mysqlpp.dll on your end user’s machines when distributing your program. My recommendation is to install it in the same directory as the .exe file that uses it, rather than installing into a system directory where it could conflict with a mysqlpp.dll built with different settings.
Once you have MySQL++ built with CLR support, open your program’s project. If you don’t already have a project set up, open Visual Studio, say File | New | Project, then choose Visual C++ | CLR | Windows Forms Application. Go through the wizard setting up the project as you see fit.
The configuration process isn’t much different from that for an MFC project, so go through the list above first. Then, make the following changes particular to .NET and C++/CLI:
Under Configuration Properties | General change the setting from /clr:pure to /clr. (You need mixed assembly support to allow a C++/CLI program to use a plain C++ library like MySQL++.)
*
For the Linker | Input settings, you don’t need wsock32.lib. The mere fact that you’re using .NET takes care of that dependency for you.
In the MFC instructions above, it said that you need to build it using the Multi-threaded DLL version of the C++ Runtime Library. That’s not strictly true for MFC, but it’s an absolute requirement for C++/CLI. See the Remarks in the MSDN article on the /clr switch for details.
You may want to study examples\vstudio\wforms\wforms.vcproj to see all this in action. Note that some of the paths will be different, because it can use relative paths for mysqlpp_d.dll and mysqlpp.dll.