MySQL Connector/C++ Developer Guide  /  Building Connector/C++ Applications  /  Building Connector/C++ Applications: Platform-Specific Considerations

5.2 Building Connector/C++ Applications: Platform-Specific Considerations

Keep these platform-specific considerations in mind for building Connector/C++ applications:

Windows Notes

On Windows, applications can be built in different modes (also called build configurations), which determine the type of the runtime library that is used by the final executable. An application can be built in debug or release mode. Then it can be built in 32-bit or 64-bit mode. Also, one can choose between the static (/MT) or the dynamic (/MD) runtime. Different versions of the MSVC compiler also use different versions of the runtime.

It is important to ensure that the compiler version and the build mode of an application match the same parameters used when building the connector library, to ensure that the connector and the application use the same runtime library.

The binary distribution of Connector/C++ 8.0 ships libraries built in release mode using dynamic runtime (/MD). The libraries are built with MSVC 2015 (the exact compiler version can be found in the BUILDINFO.txt file included in the package). Consequently, the code that uses these libraries must be built with the same version of MSVC and in /MD mode. To build code in a different mode, first build Connector/C++ from source in that mode (see Section 4.3, “Installing Connector/C++ from Source”), then build your applications using the same mode.


When linking dynamically, it is possible to build your code in debug mode even if the connector libraries are built in release mode. However, in that case, it will not be possible to step inside connector code during a debug session. To be able to do that, or to build in debug mode while linking statically to the connector, you must build Connector/C++ in debug mode first.

There are separate 64-bit and 32-bit packages, each keeping libraries in the lib64 and lib directories, respectively. Package and library names also include vsNN. The vsNN value in these names depends on the MSVC compiler version used to build the libraries (for example, vs14 for MSVC 2015). This convention enables using libraries built with different versions of MSVC on the same system.

A dynamic connector library name has a .dll extension and is used with a import library that has a .lib extension in the vsNN subdirectory. Thus, a connector dynamic library named mysqlcppconn8-1-vs14.dll is used with the import library named vs14/mysqlcppconn8.lib. The 1 in the dynamic library name is the major ABI version number. (In the future, this will help using compatibility libraries with old ABI together with new libraries having a different ABI.) The vs14 subdirectory also contains a static version of the library named vs14/mysqlcppconn8-static.lib.

A legacy JDBC connector dynamic library named mysqlcppconn-7-vs14.dll is used with the import library named vs14/mysqlcppconn.lib. The corresponding static library is named vs14/mysqlcppconn-static.lib.

When building code that uses Connector/C++ libraries:

  • Add $MYSQL_CPPCONN_DIR/include as an additional include directory and $MYSQL_CONCPP_DIR/lib64/vs14 (64-bit libraries) or $MYSQL_CONCPP_DIR/lib/vs14 (32-bit libraries) as an additional library directory in the project configuration.

  • To use the dynamic library, add mysqlcppconn8.lib to the linker options (or mysqlcppconn.lib for legacy code).

  • For use the static library, add mysqlcppconn8-static.lib (or mysqlcppconn-static.lib for legacy code).

If linking statically, the linker must find the link libraries (with .lib extension) for the required OpenSSL libraries. If the connector was installed from the binary package provided by Oracle, they are present in the $MYSQL_CONCPP_DIR/lib64/vs14 or $MYSQL_CONCPP_DIR/lib/vs14 directory, and the corresponding OpenSSL .dll libraries are present in the main library directory, next to the connector .dll libraries.


A Windows application that uses the connector dynamic library must be able to locate it at runtime, as well as its dependencies such as OpenSSL. The common way of arranging this is to put the required DLLs in the same location as the executable.

macOS Notes

The binary distribution of Connector/C++ for macOS is compiled using the macOS native clang compiler. For that reason, an application that uses Connector/C++ should be built with the same clang compiler.

The clang compiler can use two different implementations of the C++ runtime library: either the native libc++ or the GNU libstdc++ library. It is important that an application uses the same runtime implementation as Connector/C++ that is, the native libc++. To ensure that, the -stdlib=libc++ option should be passed to the compiler and the linker invocations.

To build a Connector/C++ application that uses X DevAPI, has sources in, and links dynamically to the connector library, the Makefile for building on macOS might look like this:

MYSQL_CONCPP_DIR= Connector/C++ installation location
LDLIBS = -lmysqlcppconn8
CXX = clang++ -stdlib=libc++
CXXFLAGS = -std=c++11
app :

Binary packages for macOS include OpenSSL libraries that are required by code linked with the connector. These libraries are installed in the same location as the connector libraries and should be found there by the dynamic linker.

Solaris Notes

As of Connector/C++ 8.0.13, it is possible to build Connector/C++ applications on Solaris. This requires the SunPro 5.15 or higher compiler (from Developer Studio 12.6). Earlier versions and building with GCC are not supported.

To use the Connector/C++ provided by Oracle, application code must be built with SunPro 5.15 or higher under the following options: -m64 -std=c++11. The C++ runtime libraries and atomics library used should be the defaults (-library=stdcpp, -xatomics=studio).


The connector library and any code that uses it depends on the GCC runtime libraries shipped with Oracle Developer Studio 12.6, which must be installed before you run the application. See the download options for Oracle Developer Studio here. The installation package enables you to install the runtime libraries only instead of the full Oracle Developer Studio; see instructions in Installing Only the Runtime Libraries on Oracle Solaris 11.

User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
Sign Up Login You must be logged in to post a comment.