我正在尝试使用 C++ 连接到 MySQL。我使用的 IDE 是 Visual C++ 2010。我按照 MySQL 开发页面 (http://dev.mysql.com/tech-resources/articles/mysql-connector-cpp.html) 上的步骤操作。尽管我使用了不同的操作系统 (Windows),但我完全按照给定的步骤进行操作。我在这个过程中遇到了很多链接器错误,我发现这些错误很难调试。有人可以指导我采用更好或更简单的方法来使用 C++ 访问 MySQL。
附言我已经下载了适用于 C++ 的 mysqlconnector。
最佳答案
你可以试试mysql++ ,但我敢打赌您会遇到相同的链接器错误。
是否设置了包含路径(C:...\MySQL Server 5.1\include)和库路径(C:...\MySQL Server 5.1\lib\debug)?在 VC2010 中设置全局设置你必须:
VS2010 introduces the user settings file (Microsoft.cpp..users.props) to control global settings including Global search path. These files are located at $(USERPROFILE)\appdata\local\microsoft\msbuild\v4.0 directory.
The issue you are seeing is a bug in the UI. To make it possible to change the ordering of these read-only directories, here is the workaround that you can apply:
- open up the property manager,
- right click on the .user.props file to bring up the property page
- open up VC++ Directories -> Include Directories, add new paths after $(IncludePath)
- Click on the "Edit" dropdown on VC++ Directories -> Include Directories property, the user directories as well as the inherited values will show up in the upper pane
- you can move the directory orders as you wish and save.
关于mysql - 在 VC++ 中使用 MySQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3459457/