MySQL 连接器 C++ 64 位从 Visual Studio 2012 中的源代码构建 [英] MySQL Connector C++ 64bit build from source in Visual Studio 2012

查看:35
本文介绍了MySQL 连接器 C++ 64 位从 Visual Studio 2012 中的源代码构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 Visual Studio 2012 中的源代码为 64 位 架构构建 mySQL 连接器 C++.我知道这取决于一些 boost 头文件和 C 连接器.运行 CMake 会生成一个项目文件,但该项目文件无法编译,因为有一大堆非常令人困惑的错误,这些错误可能与包含文件有关,还有更大的警告列表.官方网站帮助不大.

I am trying to build the mySQL Connector C++ from source in Visual Studio 2012 for the 64-bit architecture. I understand that it depends on some boost header files and the C connector. Running CMake produces a project file, but that project file doesn't compile because of a big list of very confusing errors which probably have to do something with the include files, and an even bigger list of warnings. The official site is of little help.

谁能列出成功编译C++连接器的所有步骤?

Could some one please list all the steps in successfully compiling the C++ Connector?

推荐答案

为了构建它,您需要具备以下条件:

In order to build it you need to have the following:

  1. 您需要安装 MySQL 服务器或 MySQL C 连接器.
  2. 已安装 Boost C++ 库 或拥有它的源文件.请注意,不需要构建 boost,因为您只需要头文件.
  3. 已安装 CMake.安装 CMake 时,它​​会询问您是否希望将其包含在 PATH 变量中,您应该选择 yes 以便以后使用它.
  1. You need to have installed either the MySQL server or the MySQL C Connector.
  2. Have installed the Boost C++ libraries or have the source files for it. Please note that there is not need to build boost as you only need the header files.
  3. Have CMake installed. When installing CMake it will ask you if you want it included in the PATH variable, you should select yes to make it easier later to use it.

一旦您拥有所有三个可用,打开 VS2012 x64 Native Tools Command Prompt 并从 MySQL C++ 连接器的源根目录中发出以下命令:

Once you have all three available, open VS2012 x64 Native Tools Command Prompt and from the source root directory of the MySQL C++ Connector you need to issue the following:

set MYSQL_DIR=c:PROGRA~1MySQLMYSQLC~1.1
cmake -G "Visual Studio 11 Win64" ^
      -DBOOST_ROOT:STRING=C:UsersuserDOWNLO~1BOOST_~1BOOST_~1 ^
      -DMYSQL_LIB_DIR:STRING=c:PROGRA~1MySQLMYSQLC~1.1LIB
devenv.com MySQLCPPCONN.sln /build Release

第一个命令定义了 MYSQL_DIR 变量,该变量指向 MySQL 服务器或 MySQL C 连接器的安装.第二个命令调用 cmake 来准备一个 64 位的 VS 项目.MYSQL_LIB_DIR 变量似乎有问题,没有生成,所以我们需要手动定义它.MYSQL_LIB_DIR 的值是 MYSQL_DIR,以 LIB 结尾.第三个命令是可选的,它将在不打开 VS 的情况下从命令提示符构建项目.

The first command defines the MYSQL_DIR variable that points to the installation of the MySQL server or the MySQL C Connector. The second command call cmake to prepare a VS project that will be 64bit. There seems to be a problem with the MYSQL_LIB_DIR variable and it does not get generated, so we need to define it manually. MYSQL_LIB_DIR has the value of MYSQL_DIR ending with a LIB. Third command is optional, it will build the project from command prompt without opening VS.

建议您对变量使用 DOS 路径.为此,导航到要转换为 DOS 路径的目录并调用 for %I in (.) do echo %~sI.它会给你转换后的路径.

It is recommended that you use the DOS paths for the variables. To do that, navigate to the directory you want to convert to DOS path and call for %I in (.) do echo %~sI. It will give you the converted path.

这篇关于MySQL 连接器 C++ 64 位从 Visual Studio 2012 中的源代码构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆