I am new to conneting to MYSQL through a C++ code; so this is what i did

i installed MySQL Server 5.1 (it was a EXE), and thats it. i opened the MYSql command line client and created a DB, and added a table and values to it.

This is my code in C++ (I'm using VS2008)

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


int _tmain(int argc, _TCHAR* argv[])
{
	
	return 0;
}

I get an error that prints fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory What have i done wrong.. can some one help me fix this ASAP.

Hi,

first of all, this post does not belong here. This is a C++ discussion thread and not about specific IDE-s or tools. How ever, your problem is that your compiler, actually your preprocessor does not know where to look for the mysql.h file. You either have to prepend the full or relative path to the mysql.h file in the include directive or to tell VS2008 where to look for mysql include files. That is, go to Tools --> Options --> Projects and Solutions --> VC++ Directories and set the mysql Include directories path or paths.

best regards

>> first of all, this post does not belong here

Actually: it does. It's about C++, so it belongs in the C++ forum.

That is, go to Tools --> Options --> Projects and Solutions --> VC++ Directories and set the mysql Include directories path or paths.

I am still stuck here. I am not sure as what path do i have to add here. I can't find a mysql.h file anywhere. Can some one please copy paste the path so that it would help me to find out what i am lacking.

It's like if you were trying to jump steps.

What library are you using to interact with an SQL database? If your answer is none... Then you need to learn how to link and use libraries with your compiler. If there's a lib or API you're using. What you need is there. Read the documentation!

Comments
Good observation

As far as I can see, before you continue with mySQL programming, you should first go through some C++ beginners tutorials. There are some really nice tutorials on the net. Use google, it's a mighty tool.

This article has been dead for over six months. Start a new discussion instead.