Re: Ansi C and MySql

Discussion in 'C Programming' started by Eric Sosman, Sep 25, 2012.

  1. Eric Sosman

    Eric Sosman Guest

    On 9/25/2012 10:21 AM, sim wrote:
    > Hello NG
    > I need a big help.
    >
    > I have an OS Windows XP, installed on it di MinGW suite in order to
    > compile C files.
    > I installed the MySql odbc connector
    >
    > I have problems on all my C files where i declare:
    >
    > #include <mysql/mysql.h>
    >
    >
    > The answer is everytime the same:
    >
    > no file…or directory


    It appears the compiler doesn't know where to find the
    #include'd files. There is probably a compiler option to
    tell it where to look, something like

    gcc -I c:/mysql7.2/include ... yourfile.c ...

    The details will vary depending on exactly where the include
    files are located.

    --
    Eric Sosman
    d
    Eric Sosman, Sep 25, 2012
    #1
    1. Advertising

  2. Eric Sosman

    Lew Pitcher Guest

    Re: Ansi C and MySql - II topic…variables

    On Tuesday 25 September 2012 12:21, in comp.lang.c,
    wrote:

    > On 2012-09-25 15:41:09 +0000, Eric Sosman said:
    >
    >> On 9/25/2012 10:21 AM, sim wrote:
    >>>
    >>>
    >>> I have problems on all my C files where i declare:
    >>>
    >>> #include <mysql/mysql.h>
    >>>
    >>>
    >>> The answer is everytime the same:
    >>>
    >>> no file…or directory

    >>
    >> It appears the compiler doesn't know where to find the
    >> #include'd files. There is probably a compiler option to
    >> tell it where to look, something like
    >>
    >> gcc -I c:/mysql7.2/include ... yourfile.c ...
    >>
    >> The details will vary depending on exactly where the include
    >> files are located.

    >
    > Hallo,
    > I resolved by typing: #include "path/path/..."
    >
    > Now I have another problem, I am creating a Query to update datas into
    > MySql…I don't know how to put into Query the variables……….


    That's more a question for the comp.databases.mysql newsgroup.

    Have you read and reviewed the MySQL API documentation? Take a look at
    http://dev.mysql.com/doc/refman/5.0/en/c.html
    and especially at the example code in
    http://dev.mysql.com/doc/refman/5.0/en/mysql-stmt-execute.html

    HTH
    --
    Lew Pitcher
    "In Skills, We Trust"
    Lew Pitcher, Sep 25, 2012
    #2
    1. Advertising

  3. Re: Ansi C and MySql - II topic…variables

    בת×ריך ×™×•× ×©×œ×™×©×™, 25 בספטמבר 2012 17:21:42 UTC+1, מ×ת sim:
    > On 2012-09-25 15:41:09 +0000, Eric Sosman said:
    >
    >
    > I resolved by typing: #include "path/path/..."
    >

    That's a good way of getting things working temporarily. But it's not a
    long term solution. The reason is that the code won't compile when moved to
    a machine with a different directory structure.
    Eric Sosman's answer, which was to fiddle about with include paths in the
    compiler's settings, is the right approach. If you're using a commandline
    com puiler, the option is usually -I. If you're compiling from an IDE,
    search the menus for "settings", "configuration", "compiler options" or
    tools like that. An option to set include paths will be in there somewhere.
    Malcolm McLean, Sep 25, 2012
    #3
  4. Eric Sosman

    Greg Martin Guest

    Re: Ansi C and MySql - II topic…variables

    On 12-09-25 12:51 PM, Malcolm McLean wrote:
    > בת×ריך ×™×•× ×©×œ×™×©×™, 25 בספטמבר 2012 17:21:42 UTC+1, מ×ת sim:
    >> On 2012-09-25 15:41:09 +0000, Eric Sosman said:
    >>
    >>
    >> I resolved by typing: #include "path/path/..."
    >>

    > That's a good way of getting things working temporarily. But it's not a
    > long term solution. The reason is that the code won't compile when moved to
    > a machine with a different directory structure.
    > Eric Sosman's answer, which was to fiddle about with include paths in the
    > compiler's settings, is the right approach. If you're using a commandline
    > com puiler, the option is usually -I. If you're compiling from an IDE,
    > search the menus for "settings", "configuration", "compiler options" or
    > tools like that. An option to set include paths will be in there somewhere.
    >


    If it's on the OP's system mysql_config is a useful tool to help with
    this. "mysql_config --include" or "mysql_config --cflags" will add the
    correct path to his compiler command line. I don't know if mysql with
    MingW would include it but ...

    Run from a bash term :
    gcc -W $(mysql_config --cflags) code.c -o code $(mysql_config --libs)
    Greg Martin, Sep 25, 2012
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    487
  2. Replies:
    11
    Views:
    1,067
    Keith Thompson
    Apr 28, 2008
  3. Frank Iannarilli

    pre-ansi to ansi c++ conversion?

    Frank Iannarilli, Jul 21, 2009, in forum: C++
    Replies:
    2
    Views:
    411
  4. Jeffrey H. Coffield
    Replies:
    1
    Views:
    1,854
  5. 88888 Dihedral

    Re: Ansi C and MySql

    88888 Dihedral, Sep 26, 2012, in forum: C Programming
    Replies:
    0
    Views:
    363
    88888 Dihedral
    Sep 26, 2012
Loading...

Share This Page