MySql mysql.h file not found in VS2008 C++ <Beginner Question>

匿名 (未验证) 提交于 2019-12-03 02:39:01

问题:

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

fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory

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;  } 

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:

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

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

Add your mysql include directories to the box.

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.

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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!