[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bugs in my code, help!!
From: |
Paul Pluzhnikov |
Subject: |
Re: Bugs in my code, help!! |
Date: |
Sat, 04 Feb 2006 09:49:49 -0800 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) |
"Al-Burak" <jalqadir@netscape.net> writes:
> This is not a question where the source code is important,
Yes, it is. You saying it isn't doesn't make it so.
> This is a bug, obviously, and I will eventually find the bug; however
> my question is, does anyone here know a better way to find this kind of
> errors than to go line by line looking for the bug?
The *trivial* way to find this bug is as follows:
assuming 'g++ -c -I... Person.cc' is the command that fails, do
g++ -E -I... Person.cc > Person.ii
Now open 'Person.ii' in your editor, and search for 'class Person'.
There can not be more than one definition, i.e. 'class Person { ... };'
> Is there a
> parameter in GCC that I can use so that the compiler is more specific,
G++ is usually already specific enough, e.g.
$ cat junk.cc
class Person { int x; };
class Person { int x; };
$ g++ -c junk.cc
junk.cc:2: error: redefinition of `class Person'
junk.cc:1: error: previous definition of `class Person'
Here g++ tells me that I've redefined 'class Person' on line 2,
and where the previous definition is.
> or become more elaborate in what/where the error is?
In the future, you'll do well to at least post the error message
you are getting. You may also wish to read this:
www.catb.org/~esr/faqs/smart-questions.html
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.