本文介绍了在VS2008 C ++中找不到MySql mysql.h文件.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试运行简单的SQL C ++程序(IDE使用VS 2008)时出现此错误

I am getting this error when trying to run a simple SQL C++ program (IDE used VS 2008)

这是我的代码的样子;

this is how my code looks like;

#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include <mysql.h>


int _tmain(int argc, _TCHAR* argv[])
{

return 0;

}

我认为我的IDE无法找到MYSQL安装的路径或类似的东西.我应该怎么做才能解决这种情况.分步说明表示赞赏.

I think that my IDE is unable to find the path of the MYSQL Installation or some thing similar. What should i do to resolve this situation. Step by step instructions appreciated.

推荐答案

1-确保您实际上已经安装了MySQL的头文件.通常,这些文件位于mysql安装目录的"include"目录中.

1 - make sure you actually have MySQL's header files installed. Typically, these are located in the 'include' directory of your mysql installation.

2-设置Visual Studio C ++项目设置,使其包含该C ++项目使用的include目录.

2 - Set your Visual Studio C++ project settings to include that include directory for use by C++ projects.

将您的mysql包含目录添加到框中.

Add your mysql include directories to the box.

工具->选项->项目和设置-> VC ++目录.然后在右侧,打开标有显示目录为"的下拉框,然后选择包含文件".这是该窗口的屏幕截图.

Tool->Options->Projects and Settings->VC++ Directories. Then on the right hand side, Open the dropbox labeled "Show Directories For" and pick "Include Files". Here's a screen shot of that window.

此外,您可能希望将库目录设置为也包含MySQL的'lib'文件夹,以便以后在构建时可以找到要链接的mysql库.

Additionally, you will probably want to set up Library directories to include MySQL's `'lib' folder as well, so that later on your builds can find the mysql libraries to link against.

这篇关于在VS2008 C ++中找不到MySql mysql.h文件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 10:11