3
3
39Ruff2016-11-21 12:08:04
MySQL
39Ruff, 2016-11-21 12:08:04

How to connect MySQL to c++ vs2013?

I registered all the necessary paths for connecting mqsql in the project, everything seems to be connected, registered, but errors are pouring in from which I can’t get rid of.
Here is the code itself:

#include "db_forms.h"
#include <QString>
#include <QLineEdit>
#include <QMessageBox>
#include <stdint.h>
#include <C:\Program Files\MySQL\MySQL Server 5.7\include\mysql.h>

db_forms::db_forms(QWidget *parent)
  : QMainWindow(parent)
{
  ui.setupUi(this);
  MYSQL mysql;
  MYSQL_RES *res;
  MYSQL_ROW row;
  if (!(mysql_real_connect(&mysql, "localhost", "user", "root", "db_forms", 3306, NULL, 0)))

  {
    QString error;
    error = mysql_error(&mysql);
    QMessageBox::information(NULL, "Error connecting to server", error );
         }

Here are the errors:
Error 2 error LNK2038: Mismatch detected for 'RuntimeLibrary': 'MT_StaticRelease' value does not match 'MD_DynamicRelease' value in db_forms.obj C:\Users\ruff\documents\visual studio 2013\Projects\db_forms\db_forms\mysqlcppconn- static.lib(plugin_client.obj) db_forms
Error 45 error LNK2005: _signal is already defined in MSVCRT.lib(MSVCR120.dll) C:\Users\ruff\documents\visual studio 2013\Projects\db_forms\db_forms\LIBCMT.lib(winsig .obj) db_forms
Error 50 error LNK2005: _fflush is already defined in MSVCRT.lib(MSVCR120.dll) C:\Users\ruff\documents\visual studio 2013\Projects\db_forms\db_forms\LIBCMT.lib(fflush.obj) db_forms
Error 33 error LNK2005: _exit already defined in MSVCRT.lib(MSVCR120.dll) C:\Users\ruff\documents\visual studio 2013\Projects\db_forms\db_forms\LIBCMT.lib(crt0dat.obj) db_forms
Error 27 error LNK2005: __set_invalid_parameter_handler already defined in MSVCRT.lib(MSVCR120.dll) C:\Users\ruff\documents\visual studio 2013\Projects\db_forms\db_forms\LIBCMT.lib(invarg.obj) db_forms
Error 39 error LNK2005: ___crtGetShowWindowMode already defined in MSVCRT .lib(MSVCR120.dll) C:\Users\ruff\documents\visual studio 2013\Projects\db_forms\db_forms\LIBCMT.lib(winapisupp.obj) db_forms
Error 44 error LNK2005: "void __cdecl terminate(void)" (? [email protected]@YAXXZ) already defined in MSVCRT.lib(MSVCR120.dll) C:\Users\ruff\documents\visual studio 2013\Projects\db_forms\db_forms\LIBCMT.lib(hooks.obj) db_forms
Error 58 error LNK1169: Multiple defined symbol found - one or more C:\Users\ruff\documents\visual studio 2013\Projects\db_forms\Win32\Release\\db_forms.exe db_forms

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question