Thread: fatal error: mysql_connection.h: No such file or directory #include "mysql_connectio

  1. #1
    Registered User
    Join Date
    Jul 2018
    Posts
    59

    fatal error: mysql_connection.h: No such file or directory #include "mysql_connectio

    I have mingw to write c++ code on windows 10. I use command line to compile and run c++ code

    C:\MinGW\include

    I get the following error when I try to compile a connector c++ program.

    fatal error: mysql_connection.h: No such file or directory
    #include "mysql_connection.h"
    ^
    compilation terminated.


    Code:
    /* Standard C++ includes */#include <stdlib.h>
    #include <iostream>
    
    
    /*
      Include directly the different
      headers from cppconn/ and mysql_driver.h + mysql_util.h
      (and mysql_connection.h). This will reduce your build time!
    */
    #include "mysql_connection.h"
    
    
    #include <cppconn/driver.h>
    #include <cppconn/exception.h>
    #include <cppconn/resultset.h>
    #include <cppconn/statement.h>
    
    
    using namespace std;
    
    
    int main(void)
    {
    cout << endl;
    cout << "Running 'SELECT 'Hello World!' 
       AS _message'..." << endl;
    
    
    try {
      sql::Driver *driver;
      sql::Connection *con;
      sql::Statement *stmt;
      sql::ResultSet *res;
    
    
      /* Create a connection */
      driver = get_driver_instance();
      con = driver->connect("192.168.0.1:3306", "root", "root");
      /* Connect to the MySQL test database */
      con->setSchema("test");
    
    
      stmt = con->createStatement();
      res = stmt->executeQuery("SELECT 'Hello World!' AS _message");
      while (res->next()) {
        cout << "\t... MySQL replies: ";
        /* Access column data by alias or column name */
        cout << res->getString("_message") << endl;
        cout << "\t... MySQL says it again: ";
        /* Access column data by numeric offset, 1 is the first column */
        cout << res->getString(1) << endl;
      }
      delete res;
      delete stmt;
      delete con;
    
    
    } catch (sql::SQLException &e) {
      cout << "# ERR: SQLException in " << __FILE__;
      cout << "(" << __FUNCTION__ << ") on line " 
         << __LINE__ << endl;
      cout << "# ERR: " << e.what();
      cout << " (MySQL error code: " << e.getErrorCode();
      cout << ", SQLState: " << e.getSQLState() << " )" << endl;
    }
    
    
    cout << endl;
    
    
    return EXIT_SUCCESS;
    
    }


    Any help would be appreciated.

    Thank you,
    Last edited by vajra11; 2 Weeks Ago at 04:45 AM.

  2. #2
    Registered User
    Join Date
    Nov 2019
    Posts
    6
    that header file:
    mysql_connection.h

    not exist at all in directory in which the compiler being run

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fatal error: mcrypt.h: No such file or directory
    By Shre in forum C Programming
    Replies: 3
    Last Post: 10-26-2015, 09:43 AM
  2. fatal error: wchar.h: no such file or directory
    By Cyberduke in forum C++ Programming
    Replies: 14
    Last Post: 09-05-2015, 12:27 AM
  3. Fatal error: SDL/SDL.h: No such file or directory
    By DecoratorFawn82 in forum C++ Programming
    Replies: 10
    Last Post: 09-10-2013, 10:43 PM
  4. fatal error: iostream: No such file or directory
    By yeohwl91 in forum C Programming
    Replies: 11
    Last Post: 10-02-2011, 11:43 PM
  5. fatal error C1083: Cannot open include file:
    By bodhankaryogesh in forum Windows Programming
    Replies: 14
    Last Post: 03-31-2008, 07:02 AM

Tags for this Thread