[fluxus] build error: PDataArithmetic.cpp
james tittle
tigital at mac.com
Mon Nov 28 15:05:23 PST 2005
hey all,
On Nov 28, 2005, at 7:43 AM, Dave Griffiths wrote:
>>
>> The recent changes to pdata in cvs give the following build error
>> on osX
>> (ie. gcc 4.0)
>>
>> PDataArithmetic.cpp:172: error: specialization of 'template<class
>> S, class
>> T> static fluxus::PData*
>> fluxus::ClosestOperator::Operate(fluxus::TypedPData<S>*, T)' in
>> different
>> namespace
>>
>> PDataArithmetic.h:129: error: from definition of 'template<class S,
>> class T> static fluxus::PData*
>> fluxus::ClosestOperator::Operate(fluxus::TypedPData<S>*, T)'
>
> I don't have gcc 4 - I can't see anything immediately obviously wrong
> here, it's defined in the same way as all the other functions - do
> they
> all error?
...yeh, came across this too with gcc 4.0.1, and after a little
hacking (meaning I don't know if this is right or not...), I got gcc
to accept it...seems that in PDataArithmetic.h, the following is
defined:
template<>
PData *ClosestOperator::Operate(TypedPData<dVector> *a, dVector *b);
...but then in PDataArithmetic.cpp:176, the following is used:
template <>
PData *ClosestOperator::Operate(TypedPData<dVector> *a, dVector b)
...so I added a "*" before "b", and that required doing the same
inside the function, such that the new one starts out looking like this:
template <>
PData *ClosestOperator::Operate(TypedPData<dVector> *a, dVector *b)
{
float closestdist=999999;
dVector closest;
for (unsigned int i=0; i<a->Size(); i++)
{
float dist = a->m_Data[i].dist(*b);
...and then it compiles without warnings! If this is a sane change,
I can commit it to cvs...
l8r,
james
More information about the Fluxus
mailing list