Thread: cannot find mysql++.h

  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    20

    cannot find mysql++.h

    Hi All

    I just install the mysql++ api, but when I compile an example ( http://tangentsoft.net/mysql++/doc/u...html#id2860437 )
    I get the following errors:
    Code:
    ~/c++> c++ main.C
    main.C:1:18: error: util.h: No such file or directory
    main.C:3:21: error: mysql++.h: No such file or directory
    main.C: In function ‘int main(int, char**)’:
    main.C:14: error: ‘mysqlpp’ has not been declared
    .....
    mysql++.h is installed in /usr/local/include/mysql++
    Also libmysqlpp.so is in /usr/local/lib (although I have no idea what its purpose is)
    Also the util.h error bother me

    Any help would be very welcome!!

    Thnx a lot
    LuCa

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    The compiler's include directory is /usr/local/include, and mysql++.h is in /usr/local/include/mysql++/mysql++.h. You're trying to include <mysql++.h>.

    See what's wrong? (Hint: the compiler doesn't search recursively for files.)

    Also, what is util.h supposed to be?

    libmysqlpp.so contains the actual implementation code of the various classes and functions declared in mysql++.h. You need to link against it, by passing
    -lmysqlpp
    to the linker (i.e. the compiler in your command line).
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Dec 2006
    Posts
    20
    Ok, now I tried the following command:
    c++ main.C -lmysqlpp -I /usr/local/include/mysql++
    Code:
    ~/c++> c++ main.C -lmysqlpp -I /usr/local/include/mysql++
    In file included from /usr/local/include/mysql++/connection.h:40,
                     from /usr/local/include/mysql++/mysql++.h:52,
                     from main.C:1:
    /usr/local/include/mysql++/defs.h:34:19: error: mysql.h: No such file or directory
    /usr/local/include/mysql++/defs.h:66: error: ‘MYSQL_FIELD’ does not name a type
    /usr/local/include/mysql++/connection.h:146: error: ‘my_bool’ has not been declared
    /usr/local/include/mysql++/connection.h:163: error: ‘my_bool’ has not been declared
    /usr/local/include/mysql++/connection.h:360: error: ‘st_mysql_options’ does not name a type
    /usr/local/include/mysql++/connection.h:427: error: ‘my_ulonglong’ does not name a type
    /usr/local/include/mysql++/connection.h:438: error: ‘my_ulonglong’ does not name a type
    /usr/local/include/mysql++/connection.h:488: error: ‘mysql_option’ has not been declared
    /usr/local/include/mysql++/connection.h:545: error: ‘MYSQL’ does not name a type
    /usr/local/include/mysql++/connection.h: In member function ‘void mysqlpp::Connection::close()’:
    /usr/local/include/mysql++/connection.h:171: error: ‘mysql_’ was not declared in this scope
    /usr/local/include/mysql++/connection.h:171: error: ‘mysql_close’ was not declared in this scope
    /usr/local/include/mysql++/connection.h: In member function ‘const char* mysqlpp::Connection::error()’:
    /usr/local/include/mysql++/connection.h:228: error: ‘mysql_’ was not declared in this scope
    /usr/local/include/mysql++/connection.h:228: error: ‘mysql_error’ was not declared in this scope
    /usr/local/include/mysql++/connection.h: In member function ‘int mysqlpp::Connection::errnum()’:
    /usr/local/include/mysql++/connection.h:235: error: ‘mysql_’ was not declared in this scope
    /usr/local/include/mysql++/connection.h:235: error: ‘mysql_errno’ was not declared in this scope
    /usr/local/include/mysql++/connection.h: In member function ‘int mysqlpp::Connection::refresh(unsigned int)’:
    /usr/local/include/mysql++/connection.h:247: error: ‘mysql_’ was not declared in this scope
    .....
    I get the impression this has nothing to do with my main.C program, because main.C looks like this
    Code:
    #include <mysql++.h>
    
    #include <iostream>
    #include <iomanip>
    
    using namespace std;
    
    int main(int argc, char *argv[])
    {
        return 0;
    }
    Any suggestion where all the errors come from ?
    Luca

    ps mysql.h is located at /usr/include

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    It can't find the MySQL C API header "mysql.h". Have you properly installed the MySQL client library?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Registered User
    Join Date
    Dec 2006
    Posts
    20
    I think I've installed everything. I can find the mysql.h file, its located at /usr/include

    UPDATE: I just found a couple of example files (which came together with the mysql++ stuff) With that Makefile (which is very long) I was able to compile the examples
    Last edited by luca; 01-16-2007 at 09:24 AM.

  6. #6
    Registered User
    Join Date
    Dec 2006
    Posts
    20
    Not sure why but this compiles
    Code:
    c++ -o xxx -I/usr/include/mysql -I/usr/include/mysql++/ -I/usr/local/include/mysql++/ -lmysqlpp -lmysqlclient main.C

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 09:13 AM
  2. Can't find DirectX!!!
    By Queatrix in forum C++ Programming
    Replies: 2
    Last Post: 07-24-2006, 07:50 PM
  3. using mysql with c++
    By yahn in forum C++ Programming
    Replies: 14
    Last Post: 03-06-2006, 07:17 PM
  4. Get data from mysql and use in a system.
    By smaakage in forum Tech Board
    Replies: 3
    Last Post: 10-04-2005, 12:03 PM
  5. Get data from mysql and use in a system.
    By smaakage in forum C++ Programming
    Replies: 5
    Last Post: 10-02-2005, 01:25 PM