public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Fwd: help for g++, please
@ 2004-11-25 16:40 Anton Greil
  2004-11-25 17:37 ` Claudio Bley
  2004-11-25 17:55 ` Nathan Sidwell
  0 siblings, 2 replies; 4+ messages in thread
From: Anton Greil @ 2004-11-25 16:40 UTC (permalink / raw)
  To: gcc-help



----------  Weitergeleitete Nachricht  ----------

Subject: help for g++, please
Date: Donnerstag, 25. November 2004 17:22
From: Anton Greil <greil@muc.de>
To: gcc-help@gcc.gnu.org

Could you give me please some advices how to update my *C and *h files
of my C++ programs?

I coded and run these programs on base of the GNU g++ compiler
of SuSE Linux 8.0 which I installed just 3 years ago.
Now I installed SuSE Linux 9.1 where the command "g++ -v" gives:
  ".... gcc version 3.3.3 (SuSE Linux)".

Invoking the new g++ on my old programs (which worked well under the old
g++ version) creates many and many error messages in connection
with header files.

Is there an information which concerns the changings in header files
(and perhaps some other new conventions) since 2001 which I should
apply that I can run my programs again?

What about the actual C++ ISO standard and its realization by g++ ?
What about please further developments in C++ ? Is there a web-site for
this question?
Where can I download please a corresponding C++ manual ?

Please excuse my questions from a today tired web-searching person
who would like in the moment to write a letter to a human person!

Thank you very much for your patience!

Anton Greil

-------------------------------------------------------

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

* Re: Fwd: help for g++, please
  2004-11-25 16:40 Fwd: help for g++, please Anton Greil
@ 2004-11-25 17:37 ` Claudio Bley
  2004-11-25 17:55 ` Nathan Sidwell
  1 sibling, 0 replies; 4+ messages in thread
From: Claudio Bley @ 2004-11-25 17:37 UTC (permalink / raw)
  To: gcc-help

On Thu, Nov 25, 2004 at 05:42:16PM +0100, Anton Greil wrote:
> 
> 
> ----------  Weitergeleitete Nachricht  ----------
> 
> Subject: help for g++, please
> Date: Donnerstag, 25. November 2004 17:22
> From: Anton Greil <greil@muc.de>
> To: gcc-help@gcc.gnu.org
> 
> Could you give me please some advices how to update my *C and *h files
> of my C++ programs?
> 
> I coded and run these programs on base of the GNU g++ compiler
> of SuSE Linux 8.0 which I installed just 3 years ago.
> Now I installed SuSE Linux 9.1 where the command "g++ -v" gives:
>   ".... gcc version 3.3.3 (SuSE Linux)".
> 
> Invoking the new g++ on my old programs (which worked well under the old
> g++ version) creates many and many error messages in connection
> with header files.
> 
> Is there an information which concerns the changings in header files
> (and perhaps some other new conventions) since 2001 which I should
> apply that I can run my programs again?
> 
> What about the actual C++ ISO standard and its realization by g++ ?
> What about please further developments in C++ ? Is there a web-site for
> this question?
> Where can I download please a corresponding C++ manual ?
> 
> Please excuse my questions from a today tired web-searching person
> who would like in the moment to write a letter to a human person!
> 
> Thank you very much for your patience!
> 
> Anton Greil
> 
> -------------------------------------------------------

Hi,

these type of questions seem to turn up over and over again. Well, here
is an extract of a FAQ I plan to write/put online sometimes which might
answer a few of your questions. (any suggestions, changes, corrections
to this article more than welcome, of course) 

<question>
Why can't gcc/g++ compile this quite simple C++ program?
</question>
<answer>
Most likely, your program is not compliant with the new C++ standard
(ANSI/ISO ...), i.e. it is not correct C++.

Here are a few things to check:

1) Make sure that your main function's return type is `int'. 
   (void is not valid!)

2) Include all the necessary standard headers you're using. 

   Note, that the standard headers don't have an extension--e.g.
   use `iostream' instead of `iostream.h'.

3) Utilize the `std' namespace. 

   The STL (Standard Template Library) has its own namespace called
   `std'. In order to use an element of the STL you could 

   a) explicitely specify the namespace:  <code lang="c++">std::cout
   &lt;&lt; "foo";</code>
   b) introduce selected members into the current namespace: 
      <code lang="c++">use std::cout; cout &lt;&lt; "foo";</code>
   c) include the whole std namespace: 
      <code lang="c++">using namespace std; cout &lt;&lt; "foo";</code>
   
Here is a complete, standard compliant (as of $today) "hello world"
C++ program:

<code lang="c++">
#include &lt;iostream&gt;

int main()
{
  using std::endl;
  
  std::cout &lt;&lt; "hello, world!" &lt;&lt; endl;
}
</code>  
</answer>



But, as you didn't go into any detail and haven't provided any code, warning / error 
messages from GCC you're on your own. If you have a problem you can't solve yourself
try to be more specific and elaborate a little on your problem. If possible/feasable
provide small complete example code which exhibits the problem.

> What about the actual C++ ISO standard and its realization by g++ ?
> What about please further developments in C++ ? Is there a web-site for
> this question?
> Where can I download please a corresponding C++ manual ?

The GCC team works very hard to totally adhere to the C++ ANSI/ISO standard. The
corresponding manual would be the most recent amendment of ISO 14882. For further
developments of C++ you could probably have a look at http://www.open-std.org.

HTH
-- 
Claudio

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

* Re: Fwd: help for g++, please
  2004-11-25 16:40 Fwd: help for g++, please Anton Greil
  2004-11-25 17:37 ` Claudio Bley
@ 2004-11-25 17:55 ` Nathan Sidwell
  2004-11-25 18:12   ` Nathan Sidwell
  1 sibling, 1 reply; 4+ messages in thread
From: Nathan Sidwell @ 2004-11-25 17:55 UTC (permalink / raw)
  To: Anton Greil; +Cc: gcc-help

Anton Greil wrote:
> 
> ----------  Weitergeleitete Nachricht  ----------
> 
> Subject: help for g++, please
> Date: Donnerstag, 25. November 2004 17:22
> From: Anton Greil <greil@muc.de>
> To: gcc-help@gcc.gnu.org
> 
> Could you give me please some advices how to update my *C and *h files
> of my C++ programs?
> 
> I coded and run these programs on base of the GNU g++ compiler
> of SuSE Linux 8.0 which I installed just 3 years ago.
> Now I installed SuSE Linux 9.1 where the command "g++ -v" gives:
>   ".... gcc version 3.3.3 (SuSE Linux)".

I guess the older compiler was a 2.95 era one.

> Invoking the new g++ on my old programs (which worked well under the old
> g++ version) creates many and many error messages in connection
> with header files.

you probably are being bitten by the '::std' namespace. in 2.95 it
was an alias for the global namespace, but in 3.3 it is a proper namespace
and the std library resides there.  You'll need to add std:: to
the appropriate types, functions and objects. (or learn about
using directives).  However, there are several other changes that
might be affecting your code, but we can't help without examples.

> Is there an information which concerns the changings in header files
> (and perhaps some other new conventions) since 2001 which I should
> apply that I can run my programs again?
You should probably read the release notes for gcc's version 3.0 onwards.

> What about the actual C++ ISO standard and its realization by g++ ?
3.3 is more conformant than previous versions.

> What about please further developments in C++ ? Is there a web-site for
> this question?
> Where can I download please a corresponding C++ manual ?
The C++ standard is available electronically from ANSI.  C++ books
are available at a good bookstore -- I'm sure google can help you
find recommended lists.

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

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

* Re: Fwd: help for g++, please
  2004-11-25 17:55 ` Nathan Sidwell
@ 2004-11-25 18:12   ` Nathan Sidwell
  0 siblings, 0 replies; 4+ messages in thread
From: Nathan Sidwell @ 2004-11-25 18:12 UTC (permalink / raw)
  To: Anton Greil; +Cc: gcc-help

Nathan Sidwell wrote:
[an answer]

of course your stupid mail system bounced it with
	'Your message attached below is being held because the address
	 <nathan@codesourcery.com> has not been verified.'

well, I'm not going to try harder, if you have such an obnoxous mail
system, don't expect any help.  You should look at the SPF record
for codesourcery.com, btw.

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

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

end of thread, other threads:[~2004-11-25 18:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-25 16:40 Fwd: help for g++, please Anton Greil
2004-11-25 17:37 ` Claudio Bley
2004-11-25 17:55 ` Nathan Sidwell
2004-11-25 18:12   ` Nathan Sidwell

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).