Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: Ansi C and MySql

Reply
Thread Tools

Re: Ansi C and MySql

 
 
Eric Sosman
Guest
Posts: n/a
 
      09-25-2012
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
http://www.velocityreviews.com/forums/(E-Mail Removed)d
 
Reply With Quote
 
 
 
 
Lew Pitcher
Guest
Posts: n/a
 
      09-25-2012
On Tuesday 25 September 2012 12:21, in comp.lang.c, (E-Mail Removed)
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/...t-execute.html

HTH
--
Lew Pitcher
"In Skills, We Trust"
 
Reply With Quote
 
 
 
 
Malcolm McLean
Guest
Posts: n/a
 
      09-25-2012
בתאריך יום שלישי, 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.
 
Reply With Quote
 
Greg Martin
Guest
Posts: n/a
 
      09-25-2012
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)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Ansi C and MySql 88888 Dihedral C Programming 0 09-25-2012 11:00 PM
Re: How to insert PDF file in to MySql and read it from MySql toJAVA App Jeffrey H. Coffield Java 1 07-24-2009 12:29 AM
pre-ansi to ansi c++ conversion? Frank Iannarilli C++ 2 07-21-2009 11:05 PM
Are there statistics packages in ANSI C and/or ANSI C++? lbrtchx@gmail.com C Programming 11 04-28-2008 03:00 AM
Are there statistics packages in ANSI C and/or ANSI C++? lbrtchx@gmail.com C++ 1 04-24-2008 06:44 PM



Advertisments