Is this a problem with my compiler

P

perltcl

Hi

I'm wondering if this is a problem with my (g++) compiler or with the
code.

I have to modify some code to make g++ compile,
else I get a no matching function error.
The commented out line were the original code,

//double ScaleX =
vtProjection::GeodesicDistance(DPoint2(left,bottom),DPoint2(right,bottom));
DPoint2 xxxx(left,bottom),yyyy(left,bottom);
double ScaleX = vtProjection::GeodesicDistance(xxxx,yyyy);

Here is the function prototype:
static double GeodesicDistance (const DPoint2 &in, DPoint2 &out, bool
bQuick=false)

BTW, I didn't write this code, I just run into this problem, while
compiling a package.
I like to know if this is a problem with my g++ compiler, or with the
code.
after that I can decide which group to report this bug.

I have a hunch the same code compiles under vc++

Thanks for your time.
 
J

Jim Langston

Hi

I'm wondering if this is a problem with my (g++) compiler or with the
code.

I have to modify some code to make g++ compile,
else I get a no matching function error.
The commented out line were the original code,

//double ScaleX =
vtProjection::GeodesicDistance(DPoint2(left,bottom),DPoint2(right,bottom));
DPoint2 xxxx(left,bottom),yyyy(left,bottom);
double ScaleX = vtProjection::GeodesicDistance(xxxx,yyyy);

Here is the function prototype:
static double GeodesicDistance (const DPoint2 &in, DPoint2 &out, bool
bQuick=false)

BTW, I didn't write this code, I just run into this problem, while
compiling a package.
I like to know if this is a problem with my g++ compiler, or with the
code.
after that I can decide which group to report this bug.

I have a hunch the same code compiles under vc++

Thanks for your time.

You didn't state what errors you were getting. I do notice, however, that
you are trying to pass a temporary as a reference. I know that I am doing
something similar in one of my programs, and I get a warning that it is a
microsoft extention.
 
F

fightwater

(e-mail address removed) 写é“:
Hi

I'm wondering if this is a problem with my (g++) compiler or with the
code.

I have to modify some code to make g++ compile,
else I get a no matching function error.
The commented out line were the original code,

//double ScaleX =
vtProjection::GeodesicDistance(DPoint2(left,bottom),DPoint2(right,bottom));
DPoint2 xxxx(left,bottom),yyyy(left,bottom);
double ScaleX = vtProjection::GeodesicDistance(xxxx,yyyy);

Here is the function prototype:
static double GeodesicDistance (const DPoint2 &in, DPoint2 &out, bool
bQuick=false)

BTW, I didn't write this code, I just run into this problem, while
compiling a package.
I like to know if this is a problem with my g++ compiler, or with the
code.
after that I can decide which group to report this bug.

I have a hunch the same code compiles under vc++

Thanks for your time.

the reason is in your function prototype, the second argument is a
reference
of DPoint2. And in your original call, you tried to pass in the
reference of a temporary
variable, which is not allowed. Since the temporary will be destroyed
after the sentence.
 
T

Thomas J. Gritzan

I'm wondering if this is a problem with my (g++) compiler or with the
code.

With the code, I believe.
//double ScaleX =
vtProjection::GeodesicDistance(DPoint2(left,bottom),DPoint2(right,bottom));
DPoint2 xxxx(left,bottom),yyyy(left,bottom);
double ScaleX = vtProjection::GeodesicDistance(xxxx,yyyy);

Here is the function prototype:
static double GeodesicDistance (const DPoint2 &in, DPoint2 &out, bool
bQuick=false)

The 'in' parameter is a const reference, so that a temporary can be bound
to it.
The 'out' parameter is non-const, since it have to be modified. You have to
pass a named object as argument to 'out'.

A compiler, that compiles the original code, is broken. Which version of
VC++ is it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,157
Latest member
MercedesE4
Top