On Fri, 29 Feb 2008 16:49:47 -0800 (PST), Jackson Kaminski <[EMAIL PROTECTED]> 
wrote:

> I am using the gnu compiler collection. It came with the first beginner's
> book I purchased.The R.H. IDE also came with the book. I had no idea  it
> was old news.
> 
> Are there updated versions of a compiler and if so, how do I check  what
> 'version' I'm running?

>From the command line, "gcc -v" should tell you which version of GCC
you've got:

For example, on three different PCs of mine:

#1:

Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v 
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr 
--enable-shared --with-system-zlib --libexecdir=/usr/lib 
--without-included-gettext --enable-threads=posix --enable-nls 
--with-gxx-include-dir=/usr/include/c++/4.1.3 --program-suffix=-4.1 
--enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug 
--enable-mpfr --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)

#2:

Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.4.6 [FreeBSD] 20060305

#3:

Reading specs from D:/devel/dev-cpp/bin/../lib/gcc-lib/mingw32/3.2/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as 
--host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls 
--enable-languages=f77,c++,objc,ada --disable-win32-registry --disable-shared
Thread model: win32
gcc version 3.2 (mingw special 20020817-1)

> As for the RHIDE, is there a more up to date Development Environment that
> works with the GCC that you could recommend?

For Windows, I'd probably recommend wxDev-C++ at this time.

http://wxdsgn.sourceforge.net/

For Mac OS X, Apple supply "X Code" on CD (possibly also for
download?), which includes GCC.

For Linux, most distros already include GCC.  KDevelop is probably
worth looking at.

> As to my original questions, though, so the header file does not get
> compiled by my actions - that is taken care of in the linking stage. But
> it does sound like I need to first compile my two .cpp files, and then
> take the object files, and 'link' them??

The header files are used at the compile stage, not the linking stage.
The act of using #include acts as a sort of substitution.  As far as
the compiler is concerned:

myfile.h:

#define X 42

myfile.cpp:

#include "myfile.h"

is identical to:

myfile.c:

#define X 42


If you wanted to avoid the IDE altogether to compile and link your
program you can do this from the command-line:

g++ -W -Wall -o myprogram main.cpp misc.cpp

You could add the -g switch to enable debugging:

g++ -g -W -Wall ....

Then use gdb to step through your program, line by line, set
breakpoints, etc.

There are tutorials about all of this on the web.  I think the help
files that come with wxDev-C++ might be of some use too.

Regards
Andrew

Reply via email to