看install win版本说要cmake 和Cygwin,手册又没有细说。网上找了,有些地方也没有说到。我下载的是mysql-5.1.35-win.zip

解决方案 »

  1.   

    这个你按照官方手册中的操作就可以了。看上去并不复杂,但没试过。
    http://dev.mysql.com/doc/refman/5.1/en/connector-c-building.html
    Building on Microsoft Windows Older versions of Microsoft Windows are not supported. Supported versions are Windows 2000, Windows XP, Windows Vista, Windows Server 2003, or Windows Server 2008. Compiler Tools Microsoft Visual Studio 8 and 9 are recommended. The Express Edition of Visual Studio and other compilers may work, but are untested. You also need CMake 2.6 or newer, available at http://www.cmake.org To Build You need to have the environment variables set for the Visual Studio toolchain. Visual Studio includes a batch file to set these for you, and installs a shortcut into the Start menu to open a command prompt with these variables set. Build MySQL Connector/C using the CMake command-line tool by entering the following from the source root directory in a command prompt window: shell> cmake -G "Visual Studio 9 2008"
    This produces a project file that you can open with Visual Studio or build from the command line with either of: shell> devenv.com libmysql.sln /build Release
    shell> devenv.com libmysql.sln /build RelWithDebInfo
    For other versions of Visual Studio or nmake based build, run the following command: shell> cmake --help
    to check the supported generators. To compile the Debug build, you must run set the CMake build type so the correct version of external libraries are used: shell> cmake -G "Visual Studio 8 2005" -DCMAKE_BUILD_TYPE=Debug
    Followed by: shell> devenv.com libmysql.sln /build Debug
    To Install To create a install package you can choose between two variants: Creating a Zip package Creating an MSI install package Zip package To create a Zip package, run the cpack command from the root of your MySQL Connector/C source directory. MSI Install package The required tools include Windows XML Installer toolset (WIX), which is available online. To create the MSI install package change to the subdirectory win and generate the makefile: shell> cmake -G "NMake Makefiles"
    Create the MSI install package by calling nmake: shell> nmake