1

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.

Shyta
  • 21
  • 2
  • 3
  • The `include` directory of your MySQL installation has to be added to your Visual Studio project settings. A similar question for boost and visual studio here, http://stackoverflow.com/questions/4281323/using-boost-and-visual-studio/4281341#4281341. Those directions should help you add in the headers. – wkl Nov 27 '10 at 05:23

1 Answers1

0

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.

alt text

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.

Community
  • 1
  • 1
wkl
  • 77,184
  • 16
  • 165
  • 176