I'm trying to make a program to load MySQL database.
The code compiles fine, but when it comes time to execute is, I have .dll errors.
My Dev C++ project settings so far:
PARAMETERS
- Linker: "-lmysql"
DIRECTORIES
- Library Directories: C:\Program Files\MySQL\MySQL Server 8.0\lib Include Directories: C:\Program Files\MySQL\MySQL Server 8.0\include C:\Program Files\MySQL\MySQL Server 8.0\include\mysql C:\Program Files\MySQL\MySQL Server 8.0\include\openssl
COMPILING LOG
Compiling project changes...
--------
- Project Filename: C:\Users\domag\Desktop\Aplikacija\SQL\Project1.dev
- Compiler Name: TDM-GCC 4.9.2 64-bit Release
Building makefile...
--------
- Filename: C:\Users\domag\Desktop\Aplikacija\SQL\Makefile.win
Processing makefile...
--------
- Makefile Processor: C:\Program Files (x86)\Dev-Cpp\MinGW64\bin\mingw32-make.exe
- Command: mingw32-make.exe -f "C:\Users\domag\Desktop\Aplikacija\SQL\Makefile.win" all
mingw32-make.exe: Nothing to be done for 'all'.
Compilation results...
--------
- Errors: 0
- Warnings: 0
- Output Filename: C:\Users\domag\Desktop\Aplikacija\SQL\Project1.exe
- Output Size: 1,83359909057617 MiB
- Compilation Time: 0,11s
And finally the CODE:
#include <iostream>
#include <mysql.h>
#include <mysqld_error.h>
char HOST[] = "ip.ip.ip.ip";
char USER[] = "user";
char PASS[] = "pass";
using namespace std;
int main()
{
MYSQL* obj;
if(!(obj = mysql_init(0)))
{
cout << "error" << endl;
}
else
{
if(!mysql_real_connect(obj, HOST, USER, PASS, USER, 3306, NULL, 0))
{
cout << "error with info" << endl;
cout << mysql_error(obj) << endl;
}
else
{
cout << "success" << endl;
}
}
return 0;
}
`
Process exited after 36.17 seconds with return value 3221225781 Press any key to continue . . . `