Topic: Clueless to g++ (v2.95.3) compiler error messages
Author: bob.news@gmx.net ("Robert Klemme")
Date: Fri, 13 Jun 2003 18:54:43 +0000 (UTC) Raw View
<kanze@gabi-soft.fr> schrieb im Newsbeitrag
news:d6652001.0306060048.f7d43d4@posting.google.com...
> so_excited@unexcite.com (Damon) wrote in message
> news:<3edc9722@news.starhub.net.sg>...
[correct comments snipped]
> On the other hand, the only cases I've found the stack trace useful in
> Java are cases which result in a fatal error.
In Java having the stack trace available often comes in handy - even for
non fatal erros, i.e. errors that don't lead to VM termination. (Do we
have the same nomenclature here?)
> On all of the C++
> implementations I've used, such a fatal error will result in a core
> dump, and it has always been possible to obtain a stack walk back (with
> full symbolic information) using a debugger, if you have a core dump and
> an unstripped executable.
This does work but is a tad more tedious than starting a program in
Eclipse (my favourite Java IDE) and click on a line in any stack trace in
the console window. When executing a C++ application in a IDE integrated
debugger you will nearly have the same convenience, I guess.
Personally I find the automated stack dumping one of the features of Java
that make development much easier that C++ development.
Regards
robert
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: moocat94122@yahoo.com (Ron Samuel Klatchko)
Date: Fri, 13 Jun 2003 22:53:06 +0000 (UTC) Raw View
so_excited@unexcite.com (Damon) wrote in message news:<3edc9722@news.starhub.net.sg>...
> Does anyone know if there is any standards governing how compilers
> should display error messages during compilation and if it is possible
> for compilers to display stack trace,
A stack trace is a runtime issue, not a compile time issue. You could
get an include file trace for (i.e. error in file a, included by file
b, included by file c, ...) but that is very different.
Are you sure you are seeing the Java compiler spit out stack traces
and not during runtime when an exception is thrown?
samuel
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: so_excited@unexcite.com (Damon)
Date: Tue, 3 Jun 2003 22:27:21 +0000 (UTC) Raw View
This is a multi-part message in MIME format.
--------------090400050903000407050400
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Hi, sorry for cross posting this but I think this maybe a more
appropriate place to ask such questions. I done a quick search in google
and i know people had asked these questions as well. But I'm curious why
there seems to be so little progress in making compilers print out more
intelligent and developer friendly error messages. I'm just starting to
learn C++ from a Java background, this is NOT a flame! If you find my
questions stupid, just ignore me, thanks.
In short the questions are:
Does anyone know if there is any standards governing how compilers
should display error messages during compilation and if it is possible
for compilers to display stack trace, line numbers that are similar to
what the Java compiler does? Thank you and have a nice day.
--------------090400050903000407050400
Content-Type: message/rfc822;
name="Re: Clueless to g++ (v2.95.3) compiler error messages"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="Re: Clueless to g++ (v2.95.3) compiler error messages"
Date: Tue, 03 Jun 2003 17:10:03 +0800
From: Damon <so_excited@unexcite.com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030313
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: alt.comp.lang.learn.c-c++
Subject: Re: Clueless to g++ (v2.95.3) compiler error messages
References: <3edc5224@news.starhub.net.sg>
In-Reply-To: <3edc5224@news.starhub.net.sg>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 202.156.47.76
Message-ID: <3edc64dc$1@news.starhub.net.sg>
X-Trace: 3 Jun 2003 17:05:32 +0800, 202.156.47.76
Organization: StarHub Internet Pte Ltd
Path: news.starhub.net.sg!202.156.47.76
Xref: newscenter.starhub.net.sg alt.comp.lang.learn.c-c++:50917
It's okie, found the problem....a missing curly bracket in another
header file.
Just sidetracking a bit, is it just g++ or are all C++ compilers so
misleading? Isn't there a standard body governing how compilers should
display error messages in compilations? Is it possible for the compiler
to do a stack trace similar to Java? Thanks.
Damon wrote:
> Hi,
>
> Really appreciate any help from any g++ guru out there. I'm unable to
> compile my header file because it keeps giving the errors below:
>
> ====================start of errors====================
> ==> make TicTacToe
> g++ -g -Wall -O -finline-functions -I. -c -o TicTacToe.o TicTacToe.cc
> In file included from
> /usr/lib/gcc-lib/i386-slackware-linux/2.95.3/../../../../include/g++-3/algorithm:34,
>
> from Input.h:7,
> from GameEngine.h:5,
> from TicTacToe.h:5,
> from TicTacToe.cc:1:
> /usr/lib/gcc-lib/i386-slackware-linux/2.95.3/../../../../include/g++-3/stl_algo.h:1146:
> ANSI C++ forbids initialization of member `__stl_threshold'
> /usr/lib/gcc-lib/i386-slackware-linux/2.95.3/../../../../include/g++-3/stl_algo.h:1146:
> making `__stl_threshold' static
> /usr/lib/gcc-lib/i386-slackware-linux/2.95.3/../../../../include/g++-3/stl_algo.h:1412:
> ANSI C++ forbids initialization of member `__stl_chunk_size'
> /usr/lib/gcc-lib/i386-slackware-linux/2.95.3/../../../../include/g++-3/stl_algo.h:1412:
> making `__stl_chunk_size' static
> TicTacToe.cc:14: parse error at end of input
> TicTacToe.cc:14: confused by earlier errors, bailing out
> make: *** [TicTacToe.o] Error 1
>
> ===================end of errors===================
>
> This is the Input.h file but it doesn't make any sense as it was
> compiling perfectly alright until i amended another header file. Many
> thanks in advance.
>
> ===============Input.h============
> #ifndef INPUT_H
> #define INPUT_H
> #include <iostream>
> #include <string>
> #include <cctype>
> #include <iterator>
> #include <algorithm>
>
>
> class Input{
>
>
> public:
> Input(){}
>
>
> ~Input(){}
>
>
> std::string read()
> {
> std::string str;
> std::getline(std::cin>>std::ws, str);
> str.erase( std::remove( str.begin(), str.end(), ' ' ), str.end() );
>
>
> std::transform(str.begin(), str.end(), str.begin(), std::toupper);
>
>
> return str;
> }
>
>
> };
>
>
> #endif
>
>
>
--
Please remove the un in the excite.com to correspond.
--------------090400050903000407050400--
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: ron@sensor.com ("Ron Natalie")
Date: Wed, 4 Jun 2003 23:15:50 +0000 (UTC) Raw View
"Damon" <so_excited@unexcite.com> wrote in message news:3edc9722@news.starhub.net.sg...
> Does anyone know if there is any standards governing how compilers
> should display error messages during compilation and if it is possible
> for compilers to display stack trace, line numbers that are similar to
> what the Java compiler does? Thank you and have a nice day.
THere is no standard to the content of the error messages in C or C++. There
are times when the compiler is required to issue some sort of message to indicate
things like syntax errors, etc..., but the nature of the message is left up to the
compiler writer.
There's no such thing as a "stack trace" at compile time anyhow.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: kanze@gabi-soft.fr
Date: Fri, 6 Jun 2003 21:05:53 +0000 (UTC) Raw View
so_excited@unexcite.com (Damon) wrote in message
news:<3edc9722@news.starhub.net.sg>...
> Hi, sorry for cross posting this but I think this maybe a more
> appropriate place to ask such questions. I done a quick search in
> google and i know people had asked these questions as well. But I'm
> curious why there seems to be so little progress in making compilers
> print out more intelligent and developer friendly error messages.
First things first. Most compilers today don't even implement all of
the standard.
> I'm just starting to learn C++ from a Java background, this is NOT a
> flame! If you find my questions stupid, just ignore me, thanks.
> In short the questions are:
> Does anyone know if there is any standards governing how compilers
> should display error messages during compilation and if it is possible
> for compilers to display stack trace, line numbers that are similar to
> what the Java compiler does? Thank you and have a nice day.
The only thing concerning error messages in the C++ standard is that
certain errors require a diagnostic. Since it is not forbidden to issue
a diagnostic in other cases as well, a compiler which systematically
output a '?' at the end of every compilation would be conform, provided
that it documented that "?" was a diagnostic in the sense of the
standard.
Obviously, quality of implementation requires a bit more. In practice,
I've not found compile time error messages that bad in C++, at least as
long as no templates are involved. (And of course, if templates are
involved, you can't very well compare with Java.)
But I think you are mixing up two things: in no language can the
compiler provide a "stack trace", since the stack doesn't exist until
run-time, when the compiler is done. C++ doesn't provide any standard
facilities for a stack track. It would be more difficult in C++ to
provide a symbolic stack trace, as in Java, because the symbolic
information in not normally loaded when executing a program. I have
code which will give a hexadecimal stack trace for Sparc and Intel
architectures, but it is highly unportable. And of course, once you've
got the hexadecimal, you have to get a map output from the linker to
read it (which in turn implies static linking).
On the other hand, the only cases I've found the stack trace useful in
Java are cases which result in a fatal error. On all of the C++
implementations I've used, such a fatal error will result in a core
dump, and it has always been possible to obtain a stack walk back (with
full symbolic information) using a debugger, if you have a core dump and
an unstripped executable.
--
James Kanze GABI Software mailto:kanze@gabi-soft.fr
Conseils en informatique orient e objet/
Beratung in objektorientierter Datenverarbeitung
11 rue de Rambouillet, 78460 Chevreuse, France, T l. : +33 (0)1 30 23 45 16
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]