This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: compile error on simple code , plz help
- From: Ian Lance Taylor <iant at google dot com>
- To: "eric lin" <ericlin at fsshl dot zzn dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 13 May 2011 23:40:57 -0700
- Subject: Re: compile error on simple code , plz help
- References: <1CA1FD547A4263344A186A3A1A443042@ericlin.fsshl.zzn.com>
"eric lin" <ericlin@fsshl.zzn.com> writes:
> eric@eric-laptop:~/practicalCpp$ g++ fixed_pt.cpp fixed_test.cpp
> In file included from fixed_pt.cpp:3:
> fixed_pt.h:211: error: âfixed_pt::fixed_pt fixed_pt::fixed_pt::operator+(const fixed_pt::fixed_pt&, const fixed_pt::fixed_pt&)â must take either zero or one argument
> fixed_pt.h:216: error: âfixed_pt::fixed_pt fixed_pt::fixed_pt::operator+(const fixed_pt::fixed_pt&, double)â must take either zero or one argument
> fixed_pt.h:221: error: âfixed_pt::fixed_pt fixed_pt::fixed_pt::operator+(double, const fixed_pt::fixed_pt&)â must take either zero or one argument
> fixed_pt.h:226: error: âfixed_pt::fixed_pt fixed_pt::fixed_pt::operator-(const fixed_pt::fixed_pt&, const fixed_pt::fixed_pt&)â must take either zero or one argument
> fixed_pt.h:231: error: âfixed_pt::fixed_pt fixed_pt::fixed_pt::operator-(const fixed_pt::fixed_pt&, double)â must take either zero or one argument
> fixed_pt.h:236: error: âfixed_pt::fixed_pt fixed_pt::fixed_pt::operator-(double, const fixed_pt::fixed_pt&)â must take either zero or one argument
> fixed_pt.h:241: error: âfixed_pt::fixed_pt fixed_pt::fixed_pt::operator*(const fixed_pt::fixed_pt&, const fixed_pt::fixed_pt&)â must take either zero or one argument
> fixed_pt.h:246: error: âfixed_pt::fixed_pt fixed_pt::fixed_pt::operator*(const fixed_pt::fixed_pt&, double)â must take either zero or one argument
> -------------------
> I just copy a couple lines of compiler result from my g++
> all three files fixed_pt
> fixed_test
> are copied from a book
> practical c++ programming
This is the wrong mailing list. The list gcc@gcc.gnu.org is for
discussions about the development of gcc itself. This message would be
OK on gcc-help@gcc.gnu.org. Please take any followups to gcc-help.
Thanks.
In this case you are really just asking a basic C++ question. And I
think you must truncated the list of error messages, because there are
basic syntax errors in your code.
static long int double_to_fp(const double the_double) {
return (
static_cast<long int>{
the_double *
static_cast<double>(fixed_exp) +
fixed_fudge_factor));
}
In "static_cast<long int>{" the '{' should be a '('.
fixed_pt& operaotr ++() {
"operator" is misspelled.
Etc.
You need to fix these problems first.
Ian