public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Supported C++ libraries
@ 2001-10-17  9:48 Inna Routgauzer
  2001-10-17 23:57 ` Rupert Wood
  0 siblings, 1 reply; 2+ messages in thread
From: Inna Routgauzer @ 2001-10-17  9:48 UTC (permalink / raw)
  To: gcc-help

Hello,

I'm looking for C++ compiler for SUN SparcStation.
If I'll download gcc 3.0.1 would it recognize such types as:
string, list, vector,..

Thank you and regards,
Inna Routgauzer

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: Supported C++ libraries
  2001-10-17  9:48 Supported C++ libraries Inna Routgauzer
@ 2001-10-17 23:57 ` Rupert Wood
  0 siblings, 0 replies; 2+ messages in thread
From: Rupert Wood @ 2001-10-17 23:57 UTC (permalink / raw)
  To: 'Inna Routgauzer'; +Cc: gcc-help

Inna Routgauzer wrote:

> I'm looking for C++ compiler for SUN SparcStation.
> If I'll download gcc 3.0.1 would it recognize such types as:
> string, list, vector,..

Yes and no.

Firstly, you hopefully know that you won't find a C++ compiler binary on
the GCC site - only source so that you can rebuild from an existing
compiler. If you're running Solaris on your SparcStation then try
http://www.sunfreeware.com/

Secondly, string list and vector are not built-in types (in this or in
any C++ compiler). You need to include the relevant Standard Template
Library header (STL) files to use these types. The STL header files are
included with GCC (as part of libstdc++-v3). However, GCC 3 follows the
C++ standard by defining these three types inside the 'std' namespace,
so you either have to address them 'std::string' etc. or import them
from the std namespace at the start of your program:

        #include <string>
        #include <vector>
        #include <list>

        using std::string;
        using std::vector;
        using std::list;

or import the whole std namespace:

        #include <string>
        #include <vector>
        #include <list>

        using namespace std;

(I personally prefer the individual imports, but I guess it's up to
you.)

Finally, when you're compiling and linking C++ code, make sure you
invoke 'g++' and not 'gcc'.

Good luck,
Rup.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-10-17 23:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-17  9:48 Supported C++ libraries Inna Routgauzer
2001-10-17 23:57 ` Rupert Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).