Visual Studio 13 compiled MYSQL CONNECTOR C/C++ (MYSQLCPPCONN), there is a friend in need of reference.
MySQL", "Community", "Server", "
" and "green edition" are OK
MySQL Connector/C", "download source
MySQL Connector/C++", "download source
Visual Studio does not say, do not have it, compile what
install MySQL Server, it is best to run properly,
compiles Connector/C (because Connector/C++ relies on Connector/C)
Unzip the source code, such as release to the F disk, and renamed MySQLC (just for convenience),
Open CMAKE-GUI (find in the installation directory), Source Path, select F:mysqlc, Build Path, select F:buildc,
Build Path can be as Path as Source
Click Configure, select the compiler and platform, click Finish, appear "Configuring done", and then click Generate
After the "Generating done" appears, the CMAKE section is finished,
In the "F:buildc", find the project file (SLN), open, compile (note Debug and Release), and the C component gets the
Unzip, rename mysqlcpp
Open CMAKE-GUI, directory select "F:mysqlcpp" and "F:buildcpp"
Point Configure, there is an error, need BOOST, extract to "F:boost"
CMAKE interface click "Add Entry" (add environment variables)
"Name=", "BOOST_ROOT", "Type=", "String", "Value=", "F:boost", "OK
Click Configure again, make a mistake, unable to find "mysql.h", open FindMySQL.cmake to view content, and then add environment variable
"Name=", "MYSQL_INCLUDE_DIR", "Type=", "Path", "Value=", "F:mysqlcinclude", "OK
Then point Configure, error, lack of "MYSQL_LIB", note that here decided dynamic linking or static link if the static link, add environment variables, Name=, Type=BOOL, Value "MYSQLCLIENT_STATIC_LINKING" tick add environment variables, Name= "MYSQL_LIB", "Type= FILEPATH Value=", "F:buildclibmysqlReleasemysqlclient.lib" or "F:buildclibmysqlReleaselibmysql.lib (static link)"
Another Configure, error, need MySQL Server version
Then add the environment variables, Name=, MYSQL_VERSION, Type=, String, Value=, x.x.x (MySQL, Server, version number),
Configure again, you can wait a little while, appear "Configuring done", and then point "Generate
After that, you can compile to
Compile time and error (end up), missing file
From the MySQL Server installation directory include, find the my_config.h/mysql_version.h/mysqld_error.h three files
Copy to F:mysqlcinclude,
Continue to compile, make a mistake (go crazy), MYSQL_TYPE_JSON is undefined, look at the source, and know that it should be an enumeration type
But what is the value of the search engine, search with another enumeration name,
For example, I search for "MYSQL_TYPE_JSON MYSQL_TYPE_NEWDECIMAL"
Learn "MYSQL_TYPE_JSON=245" and add "
Continue to compile, and finally finished, compile successfully,.
compiling Connector/C is very simple, a few steps on it.
And compiling Connector/C++ is more difficult, skilled funeral, add the environment variables will be much better,
Note: Connector/C++ relies on the MYSQL SDK, try to use the Connector/C band file, no more go to MySQL Server to find the file
Compile note Debug/Release, MD/MT, and other parameters, to be consistent,
CMAKE 3.5.0 non installation board
MySQL, Community, Server, 5.6.30, non installation version,
MySQL Connector/C 6.1.6
MySQL Connector/C++ 1.1.6
Visual Studio 2013