To build Connector/C on Microsoft Windows, Visual Studio 8 or 9 is recommended. The Express Edition of Visual Studio and other compilers might work, but are untested.
You also need CMake 2.6 or newer, which is available from cmake.org.
To build and install the source distribution, use the following procedure:
Set the environment variables for the Visual Studio toolchain. Visual Studio includes a batch file to set these for you, and installs a shortcut in the Start menu to open a command prompt with these variables set.
Change location to the top-level directory of the source distribution.
Makefileby entering the following command in a command-prompt window:
cmake -G "Visual Studio 9 2008"
For other CMake options that you might find useful, see Other Connector/C Build Options.
The result of the cmake command is a project (solution) file,
libmysql.sln, that you can open with Visual Studio. Alternatively, build from the command line with either of these commands:
devenv.com libmysql.sln /build Release
devenv.com libmysql.sln /build RelWithDebInfo
For other versions of Visual Studio or for an
nmake-based build, use the following command to check which generators can be specified with the
To compile a Debug build, you must set the CMake build type so the correct external library versions are used, then compile using the
cmake -G "Visual Studio 9 2008" -DCMAKE_BUILD_TYPE=Debugshell>
devenv.com libmysql.sln /build Debug
A normal build builds the C API libraries for the
libdirectory. A Debug build additionally builds debug libraries for the
lib/debugdirectory. You must use the debug libraries to compile clients built using the debug C runtime.
Use the install operation provided by your development environment to install the Connector/C headers, libraries, and utilities. You can also use this CMake command:
cmake --build . --target INSTALL --config RelWithDebInfo