Game Development Community

Compile Problem Head w/Metrowerks

by Dave Bacher · in Torque Game Engine · 06/22/2002 (1:47 pm) · 2 replies

There are two places where a nonconst reference (MatrixF &) is being assigned to a const object within a const method.

You cannot legally assign a const object to a non-const reference; either the reference must be changed to a const reference, or the function must return something that isn't a const.

In both cases I saw, adding a const to the reference corrected compilation, but I've yet to execute it, so I don't know if it may have introduced additional problems.

An example of this would be:
MatrixF & MyMatrix = SomeFunction(); // bad if SomeFunction returns const MatrixF...

const MatrixF & MyMatrix = SomeFunction(); // better; now the reference is const and legal

Unfortunately, I lost both of the changes that are required, but if you pull it up in CW7 and compile, it ought to be pretty obvious. Was using the Win32 Debug build off of head.

#1
06/23/2002 (8:34 am)
fixed it.

d
#2
06/23/2002 (8:52 am)
Thanks, seems to have fixed the compile problem in linux =)