Recently, code: blocks was used in Windows for wxWidgets program development. You need to access the MySQL database on the server. The remote access to MySQL is involved here. You need to configure mysql. There are many specific configuration methods, so I will not talk about it. The wxWidgets project configuration process is as follows:
1. Right-click Project-> properties, open the project/Project Options dialog box, click the build Option Button in the lower right corner of the project, and add the Link Library in the connector settings Tab
C:/program files/MySQL Server 5.0/lib/opt/libmysql. Lib
2. Add it to the search path
C:/program files/MySQL Server 5.0/include
To compile and link. However, the following error occurs during running:
The dynamic link library is missing in windows, so the functions used in the program cannot be found. Find the libmysql1.dll file in the installation directory of MySQL, copy it to the directory where the project is located, and run the program. Everything is OK!
C:/program files/MySQL Server 5.0/is the installation directory of MySQL. Because the database on the server is accessed, libmysql is required for running the program. lib, the relevant header file and libmysql1.dll. You don't need anything else. Therefore, copy the lib and include directories under the MySQL installation directory to the project directory, and then perform the preceding configuration. For example, if the project directory is E:/projects/mysqltest, create a folder named MySQL and copy the related files to the directory.
Copy the Lib file under C:/program files/MySQL Server 5.0/lib/opt/
E:/projects/mysqltest/MySQL/lib directory.
Copy the. h file in C:/program files/MySQL Server 5.0/include
E:/projects/mysqltest/MySQL/include directory.
Add it to the Link Library in the connector settings label
E:/projects/mysqltest/MySQL/lib/libmysql. Lib
Add to search path
E:/projects/mysqltest/MySQL/include
The configuration is complete. Of course, do not forget to copy libmysql1.dll to the current project directory.
In this way, each client does not need to install the MySQL database, which saves space and saves the trouble of installation and greatly facilitates user use.