I've spent the last 4 days trying to accomplish the following task: - create a MySQL Database - connect to the database in a c++ win32 application so I can use the data and/or edit the data.

我花了最近4天尝试完成以下任务: - 创建一个MySQL数据库 - 连接到c ++ win32应用程序中的数据库,这样我就可以使用数据和/或编辑数据。

So far so good, I'm using the following: - Packard Bell with 64bit Windows 7 Home Edition - Visual C++ Express 2010 - Downloaded and installed mysql 5.5 (choosing the complete installation)

到目前为止,我正在使用以下内容: - Packard Bell与64位Windows 7家庭版 - Visual C ++ Express 2010 - 下载并安装mysql 5.5(选择完整安装)

I have no problems using the mysql terminal and creating a simple Database, however establishing a connection to it in my c++ code is a major hurdle. Some tutorials, forums etc. recommend connecting directly and others suggest using ODBC. The first suggestion leads to a ton of issues with Visual Studio not being able to find source files when including header files: mysql_connection.h

我使用mysql终端并创建一个简单的数据库没有问题,但是在我的c ++代码中建立与它的连接是一个主要障碍。一些教程,论坛等建议直接连接,其他建议使用ODBC。第一个建议导致Visual Studio在包含头文件时无法找到源文件的大量问题:mysql_connection.h

cppconn/driver.h

cppconn/exception.h

etc...

could not find the solution for these issues so I turned to ODBC and found the following code:

找不到这些问题的解决方案所以我转向ODBC并找到以下代码:

(see next post, was not allowed to post more than 2 links)

(见下一篇文章,不允许发布超过2个链接)

The code actually compiles but can't find anything. See screen below: http://imageshack.dk//viewimage.php?file=/imagesfree/CD525364.jpg

代码实际上编译但找不到任何东西。见下面的屏幕:http://imageshack.dk//viewimage.php?file = / imagesfree / CD525364.jpg

I can't find the solution for the problem. This ODBC Data source "mysql" has been set up manually as shown below: http://imageshack.dk//viewimage.php?file=/imagesfree/WEG25517.jpg

我找不到问题的解决方案。此ODBC数据源“mysql”已手动设置,如下所示:http://imageshack.dk//viewimage.php?file = / imagesfree / WEG25517.jpg

I've read the official mysql documentation for setting up visual studio with the right directories and libraries and since the code compiles that can't be the problem right?

我已经阅读了官方的mysql文档,用于设置具有正确目录和库的visual studio,并且因为代码编译不成问题对吗?

I would really appreciate any help or suggestions :) thanks in advance.

我真的很感激任何帮助或建议:)提前感谢。

1 个解决方案

#1


2

Have you configured your project properties? I am assuming that you've installed MySQL at C:\MySQL

您是否配置了项目属性?我假设你已经在C:\ MySQL安装了MySQL

Open visual studio --> Solution Explorer --> Right Click --> Properties --> C/C++ --> General --> Add Include Directories --> Click to edit and write C:\MySQL\include (or where ever you've installed MySQL and locate its include folder).

打开visual studio - >解决方案资源管理器 - >右键单击 - >属性 - > C / C ++ - >常规 - >添加包含目录 - >单击编辑并编写C:\ MySQL \ include(或其中)你有没有安装MySQL并找到它的include文件夹)。

Now in same properties dialog navigate to Linker --> General --> "Add additional Library Directories" --> (write the path of folder which contains .dll or .lib files e.g. C:\MySQL\Connector ODBC)

现在在相同的属性对话框中导航到链接器 - >常规 - >“添加其他库目录” - >(写入包含.dll或.lib文件的文件夹的路径,例如C:\ MySQL \ Connector ODBC)

In same properties dialog navigate to Linker --> Input --> Additional Dependencies --> (write the name of .lib file you want to use e.g. libmysql.lib or any other library you want to use which is placed in above "Additional Libraray Directories").

在相同的属性对话框中导航到链接器 - >输入 - >附加依赖项 - >(写入要使用的.lib文件的名称,例如libmysql.lib或您要使用的任何其他库,位于上面“附加Libraray目录“)。

Hope it will help you.

希望它会对你有所帮助。

更多相关文章

  1. PHP MYSQL 出现中文乱码的解决方案
  2. Amoeba for MySQL---分布式数据库Proxy解决方案
  3. MySQL数据库导入或者同步大量数据时数据丢失解决方案
  4. 关于mysql 和Oracle的一大堆麻烦问题的解决方案
  5. 关于mysql无法添加中文数据的问题以及解决方案
  6. 关于如何更好的监听元素属性的变化(转)
  7. JavaScript 中 Object ,Prototype 相关的属性和方法
  8. Dojo:不能在AccordionContainer.js中读取未定义的属性“h”。
  9. ng- repeat显示的行等于no属性,甚至不显示html视图上的数据

随机推荐

  1. android 启动时会多显示一个闪现屏
  2. Android内核编译和裁剪
  3. Spinner 使用方法小结
  4. ListView中使用线程实现无限加载
  5. Android发送邮件
  6. 2010.12.28——— android menu用法
  7. android 中的定时任务
  8. Android Studio编译失败:Error: Invoke-cu
  9. TextView 点击拨打电话
  10. Android文章收藏