Standard library confusion

From: Walkaway Renouf (walkaway_at_anon.com)
Date: 02/29/04


Date: Sun, 29 Feb 2004 12:07:25 +0100

I'm about to try to teach myself C++ and have a couple of books on order
from Amazon. But I'm the impatient type, and while I'm waiting for them
to arrive, I figured I'd find what I can on the web. The problem is,
this has led to a little confusion (not surprising really).

I'm using SuSE 8.2. I have a couple of compilers at my command - g++ and
gcc.

It would seem that g++ uses library files such as <iostream> which, if I
understand correctly, is the older style of doing things. When using
gcc, I use something like <stdio.h>, which is part of the current
standard library - is that right?

Now, gcc looks for its standard library files in /usr/include/ and g++
looks in /usr/include/g++/ - which is all very well, but is it possible
to mix the two? The reason I ask is that the programs I want to write
will probably involve MySQL databases, so I want to use the MySQL++ API.
This, although it claims to be compiled for the gcc compiler, seems to
use things like <iostream>. To confuse things further, it wants MySQL
header files which are in /usr/include/mysql/. The compilers don't
appear to look in there when they encounter:
#include <mysql.h>

So here are some specific questions (I have googled on these to some
extent, but have had trouble getting straight answers):

* If, say, gcc is configured to look in /usr/include/ for header files,
will it automatically look in sub-directories too?
* If not (as I suspect), should I change gcc's configuration to include
any sub-dirs I want to use - such as /usr/include/mysql/?
* Would it be sensible to also change gcc's config to look in
/usr/include/g++/ in case it encounters older-style headers in API or
other header files? Or might this lead to other problems?

Any help would be appreciated.



Relevant Pages

  • Re: Which PIC18 C Compiler?
    ... Walter gave a good answer regarding recursion in 8051 compilers, totally unrelated to gcc and/or sdcc (since there is no gcc port for the 8051). ... But in my experience on ColdFire's and PPC's, it has generated similar to or better than the few commercial compilers I have seen. ...
    (comp.arch.embedded)
  • Re: math.nroot [was Re: A brief question.]
    ... >>> Ah, but as I've said before, virtually all C compilers on 754 boxes ... >>> happy to use gcc, they all could have used the older gcc spellings ... > use glibc, they all could have used the older glibc spellings. ... for setting traps) interfaces, and I can't be arsed to go through old ...
    (comp.lang.python)
  • Re: math.nroot [was Re: A brief question.]
    ... >> happy to use gcc, they all could have used the older gcc spellings ... parings of C compilers and C runtime libraries are ... use glibc, they all could have used the older glibc spellings. ... trap doesn't actually fire until the _next_ fp operation ...
    (comp.lang.python)
  • Re: What is Linux built with? (or, what does this question mean?)
    ... Isn't the kernel/distro nearly always built w/ gcc? ... Now some of us actually have other compilers as well and these could be ... specific to provide cache and other optimizing that can't be generic. ... gnu compile in a way that it gives some registers over to the kernel as far ...
    (alt.os.linux.suse)
  • Re: g77 mex problem under win
    ... Don't have my matlab available, but as far as I can remember, ... Why do you insist on using gcc? ... You can buy good C compilers for a couple of hundred ... The same goes for me with the fortran compilers I have seen. ...
    (comp.soft-sys.matlab)