Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   Re: Ansi C and MySql (http://www.velocityreviews.com/forums/t952664-re-ansi-c-and-mysql.html)

Eric Sosman 09-25-2012 03:41 PM

Re: Ansi C and MySql
 
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
esosman@ieee-dot-org.invalid

Lew Pitcher 09-25-2012 05:08 PM

Re: Ansi C and MySql - II topic…variables
 
On Tuesday 25 September 2012 12:21, in comp.lang.c, simisa@tiscalinet.it
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"

Malcolm McLean 09-25-2012 07:51 PM

Re: Ansi C and MySql - II topicvariables
 
בתאריך יום שלישי, 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.

Greg Martin 09-25-2012 08:35 PM

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)


All times are GMT. The time now is 08:58 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57