Thread: problem when calling mysql.h

  1. #1
    Registered User
    Join Date
    Jan 2012
    Location
    Sevnica, Slovenija
    Posts
    1

    Exclamation problem when calling mysql.h

    Hi! I have a prolem with include header for mysql "mysql.h". I use OS linux Ubuntu 10.04 LTS. I know where are headers for database mysql. In directory
    Code:
    /usr/include/mysql/mysql.h
    my simple source in c++:
    Code:
    //example0001.cpp
    #include <iostream>
    #include <mysql>
    
    int main(){
    cout << "Hello world" << endl; return 0;
    }
    Error is:
    Code:
     skripte/primer_mysql001.cpp:3:17: error: mysql: No such file or directory
    what is wrong with such a simple example.
    Thanx for answer.

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    Your include file is "mysql.h" not "mysql" you need to add the proper extension. You may also need to specify the correct subdirectory: <mysql/mysql.h>.



    Jim

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    Don't forget to link with the correct library or you will get other errors when trying to compile.

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Btw, you are having problems including mysql.h, not calling. Proper terminology is important.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to properly return MySQL results to a calling function?
    By Effenberg0x0 in forum C Programming
    Replies: 3
    Last Post: 06-09-2011, 03:42 AM
  2. MySQL Problem
    By acbarberi in forum C Programming
    Replies: 4
    Last Post: 03-01-2010, 09:57 PM
  3. Problem with MYSQL
    By maxorator in forum C++ Programming
    Replies: 9
    Last Post: 08-25-2005, 02:33 AM
  4. linker problem with mysql
    By august_01 in forum C++ Programming
    Replies: 1
    Last Post: 04-24-2005, 11:04 AM
  5. Mysql Problem
    By gvector1 in forum C# Programming
    Replies: 1
    Last Post: 10-22-2003, 01:55 PM