List:General Discussion« Previous MessageNext Message »
From:Uri Even-Chen Date:March 2 2000 6:04pm
Subject:Re: help with MySQL setup
View as plain text  
Tim,

Thank you very much. it does work, of course. I also didn't find it in
the documentation of gcc or g++. I know this is related to the compiler
and not to mySQL, but still, I suggest you consider putting it in the
documentation of the C & C++ API programs for mySQL, to help users know
how to compile mySQL with this API. maybe you should give an example
there, just like the example you gave me.

by the way, I have a lot of experience in programming, but very little
experience with Unix standard utilities. please forgive me for my
questions related to this subject.

best regards,
Uri.


Thimble Smith wrote:
> 
> On Thu, Mar 02, 2000 at 06:50:20PM +0200, Uri Even-Chen wrote:
> >I have so many problems in compiling my programs with mysql++. I have
> >already installed mySQL and mysql++, but I didn't find information on
> >how to compile files with it. I keep getting compilation errors, even
> >after I added all the include library options -I, -L and -l. I'm not
> >using any Makefile, but I compile everything from a script. I even can't
> >compile your examples. my compilation command is (I tried every possible
> >option):
> >
> >`/usr/bin/g++ -L/usr/lib/mysql -lmysqlclient -lmysql++ -I
> >/usr/local/include/mysql++/ -I /usr/include/mysql/  simple1.cc`
> 
> Uri Even-Chen,
> 
> The problem is that you need to put the linker flags at the
> end of your compile line.  This sounds ridiculous, and maybe
> it is, but that is how the compiler tools work together.
> 
> Let me show you using the example line above, which will not
> work.  This line, below, will work:
> 
> /usr/bin/g++ -I/usr/local/include/mysql++ -I/usr/include/mysql \
>     simple1.cc -L/usr/lib/mysql -lmysql++ -lmysqlclient
> 
> This is not intuitive (why should it matter what in order you put
> the flags?  Why should the flags go *after* the file name you are
> compiling?  It also is not well-documented anywhere.  I think
> everyone who has ever programmed in C on Unix can remember having
> this trouble and being very frustrated.
> 
> Also, it is important in what order those -lxxxx flags are.  I
> think of it this way:
> 
>     simple1.cc --(uses)--> -lmysql++ --(uses)--> -lmysqlclient
> 
> So you must have simple1.cc first, -lmysql++ second, and finally
> -lmysqlclient.  Please note that this has nothing, really, to do
> with MySQL - it is how the compiler tools are designed!
> 
> Good luck!
> 
> Tim
> --
> Tim Smith   < tim@stripped >  :MySQL Development Team:  Boone, NC  USA.

-- 
--------------------------------------------------------
Uri Even-Chen
Speedy Software
Raanana, Israel.
E-mail: webmaster@stripped
ICQ Number: 7461268
Phone Number: 09-7715013
--------------------------------------------------------
Welcome to Speedy Net (In Hebrew):
   http://www.speedy.co.il/
Speedy Dating (In Hebrew):
   http://www.speedy.co.il/dating/
Speedy Composer (In English):
   http://www.speedy.co.il/composer/
--------------------------------------------------------
Thread
help with MySQL setupUri Even-Chen15 Feb
  • Re: help with MySQL setupsinisa15 Feb
    • Re: help with MySQL setupUri Even-Chen2 Mar
      • Re: help with MySQL setupsinisa3 Mar
    • still problems with mysql++Uri Even-Chen2 Mar
      • Re: still problems with mysql++Thimble Smith3 Mar
    • Re: help with MySQL setupTonu Samuel3 Mar
    • Re: still problems with mysql++Tonu Samuel3 Mar
    • Re: still problems with mysql++Uri Even-Chen3 Mar
    • Re: still problems with mysql++Tonu Samuel3 Mar
    • Re: another bug report with mysql++Uri Even-Chen5 Mar
      • Re: another bug report with mysql++sinisa5 Mar
        • Re: segmentation fault with mysql++Uri Even-Chen5 Mar
          • Re: segmentation fault with mysql++sinisa6 Mar
        • Re: segmentation fault with mysql++Uri Even-Chen7 Mar
          • Re: segmentation fault with mysql++Thimble Smith7 Mar
  • Re: help with MySQL setupUri Even-Chen1 Mar
  • Re: help with MySQL setupTonu Samuel1 Mar
  • Re: help with MySQL setupUri Even-Chen2 Mar
    • Re: help with MySQL setupsinisa2 Mar
    • Re: help with MySQL setupThimble Smith2 Mar
  • Re: help with MySQL setupUri Even-Chen2 Mar
    • Re: help with MySQL setupsinisa2 Mar