Unresolved external symbol - MySQL API C++
- by Zack_074
Hey I've had nonstop problems with SQL. I'm trying to get some experience because I know it's a vital part of the industry. I got it working with C#, but now I'm working on connecting to a database in c++. I have the project properly linked and what not. Here's my code and the errors I'm getting.
#include "stdafx.h"
#include <mysql.h>
#include <iostream>
MYSQL mysql;
MYSQL_RES result;
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
mysql_init(&mysql);
if(!mysql_real_connect(&mysql, "localhost", "root", "angel552002", "MyDatabse", 0, NULL, 0))
{
printf("Failed to connect");
}
return 0;
}
and the errors:
Error 1 error LNK2001: unresolved external symbol _mysql_real_connect@32 c:\Users\Zack-074\documents\visual studio 2010\Projects\MySql\MySql\MySql.obj
Error 2 error LNK2001: unresolved external symbol _mysql_init@4 c:\Users\Zack-074\documents\visual studio 2010\Projects\MySql\MySql\MySql.obj
Error 3 error LNK1120: 2 unresolved externals c:\users\zack-074\documents\visual studio 2010\Projects\MySql\Debug\MySql.exe 1
I really appreciate the help.