Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2004

    Question Unanswered: can't connect VC++6 to MySQL

    Hello everyone,

    I'm pretty new with Visual c++6 but I'm trying to connect to MySQL server with no success.
    When I compile my code, I get this error "fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
    Error executing cl.exe."

    I did put the file libmySQL.lib in the VC++ lib folder. I have also set the path through tools->options->Directories and then entered the VC++lib folder path. I also went to Project->settings ->links and I entered libmySQL.lib to the Object/Library modules text box.
    I'm not sure if libmySQL.lib is the right file to use. I saw some posting where they talk about mysql++.lib as the file to use but I just can't find it anywhere.
    Can somedoby help me on this problem??

    this is the code that compile and where I get the error message.

    using namespace std;
    #define host "localhost"
    #define username "username"
    #define password "password"
    #define databse "Mydatabse"

    MYSQL *conn;

    int main()

    conn = mysql_init(NULL);
    mysql_real_connectconn,host,username,password,data bse,0,NULL,0);

    MYSQL_RES *res_set;
    MYSQL_ROW row;
    unsigned int i;

    mysql_query(conn,"SELECT * FROM users WHERE userid=1);
    res_set = mysql_store_result(conn);
    unsigned int numrows = mysql_num_rows(res_set);
    for(i=0; i<mysql_num_fields(res_set); i++)
    printf("%s\n",row[i] != NULL ? row[i] : "NULL");

    return 0;


  2. #2
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    When you compile a C program, there are source files (headers like mysql.h) and object files (like libMySQL.lib), and both have to be present to create an executable. You've apparently got the library file, but not the header file.

    You probably have to modify either the source code to include the pathname to MySQL.h, or much better need to modify the include files variable to include the directory that contains MySQL.h so that the compiler can find it.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts