public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* problem with g++
@ 2003-03-26 12:49 Anjali Sharma
  2003-03-26 15:09 ` Andreas Schwab
  0 siblings, 1 reply; 2+ messages in thread
From: Anjali Sharma @ 2003-03-26 12:49 UTC (permalink / raw)
  To: gcc

Hi All,

 I am trying to compile a sample .cpp  file using g++ :-

int addptc(a)
int a;
{
 a=123;
}

I get the following errors :-
try.cpp:1: `a' was not declared in this scope
try.cpp:2: syntax error before `int'

If I use the new style format for function arguments as follows :-
int addptc(int a)
{
a=123;
}

then there are no such errors.

Could anyone please suggest if there is any solution by passing command
line options to g++ ,instead of changing the source code ?

Thanks ,
Anjali




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

* Re: problem with g++
  2003-03-26 12:49 problem with g++ Anjali Sharma
@ 2003-03-26 15:09 ` Andreas Schwab
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Schwab @ 2003-03-26 15:09 UTC (permalink / raw)
  To: Anjali Sharma; +Cc: gcc

Anjali Sharma <anjalis@cdotd.ernet.in> writes:

|> Hi All,
|> 
|>  I am trying to compile a sample .cpp  file using g++ :-
|> 
|> int addptc(a)
|> int a;
|> {
|>  a=123;
|> }

This is no valid C++.  Please consult your favorite C++ tutorial.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

end of thread, other threads:[~2003-03-26 13:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-26 12:49 problem with g++ Anjali Sharma
2003-03-26 15:09 ` Andreas Schwab

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