I need to add MYSQL to Visual studio 2008, and run a simple SQL may be an insert to verify everything is working. so this is what i did.

i got this part from a forum>>

go to control panel>administrative tools>odbc datasource

then on user dsn click add select Mysql odbc 3.51 driver then a window will open put localhost in it and if u have user name and password then fill it otherwise leave it blank.

after this if u goto drop down list u will find all databases just select one u wish to connect then save it remeber to put the name of odbc connection.

once done u can goto server explorer in visual studio click add connection

select odbc source then a window will appear ! you will see odbc connection name u created there just select it and press test connection if succeeded press ok u will see ur server there .

I thought everything was fine, and then went on to write the code, my code looks like this...

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


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

I ended up having this error.

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

Seems like i will have to add the mysql.h file some where and i am not sure if i have the mysql.h file with me. How to solve this?

Recommended Answers

All 3 Replies

Instead of opening a new post with every problem you encounter you should do as you were advised in your other posts and learn how to do a couple of things before attempting to use this tool you don't know.

You need to learn how to use libraries with Visual Studio 2005/2008/2010. Google is there for you and has a lot, you'll waste time waiting for answers here.

Can you answer this questions?
1) Why are you using precompiled headers?
2) How do you use libraries which only have header files?
3) How do you link a static or dynamic library to a project?
4) How do you USE that library.

Learn those.

Also, Google the error Codes that the compiler gives you and learn what they are and how to fix them. In this case, google C1083.

Google is the easiest way to find the answer without having to type so much in detail, like i did above. I have already done that, so the reason i posted it here is because i didn't find the answer from it.

Are you using the same google I'm using...? :S

first result for C1083:
http://msdn.microsoft.com/en-us/library/et4zwx34(VS.80).aspx

Set your include directory to the path that contains the header you need. That's the solution.

But, as you don't seem to be familiar with libraries, you'll probably encounter one problem after the other.

Reading material:
http://www.learncpp.com/cpp-tutorial/a1-static-and-dynamic-libraries/
http://www.learncpp.com/cpp-tutorial/a2-using-libraries-with-visual-studio-2005-express/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.