Mailinglist Archive: opensuse-packaging (222 mails)

< Previous Next >
Re: [opensuse-packaging] Need help with gcc45 error
  • From: Robert Schweikert <rschweikert@xxxxxxxxxx>
  • Date: Thu, 08 Apr 2010 08:40:17 -0400
  • Message-id: <4BBDCEB1.5000204@xxxxxxxxxx>


Dave Plater wrote:
Hi, I've the following errors in the gcc45 build of multimedia:apps dirac :-
quant_chooser.cpp: In member function 'void
dirac::QuantChooser::SetSkip(dirac::CodeBlock&, int)':
quant_chooser.cpp:343:49: error: invalid operands of types
'__gnu_cxx::__enable_if<true, double>::__type' and 'int' to binary
'operator<<'
in line 343 where [i] is column 49 :-
if ( (std::abs(m_coeff_data[j][i])<<2) >= u_threshold )
can_skip = false;
In function :-
void QuantChooser::SetSkip( CodeBlock& cblock , const int qidx)
{
const int u_threshold = dirac_quantiser_lists.QuantFactor4( qidx );
// Sets the skip flag for a codeblock
bool can_skip = true;
for (int j=cblock.Ystart(); j<cblock.Yend(); ++j )
{
for (int i=cblock.Xstart(); i<cblock.Xend(); ++i )
{
if ( (std::abs(m_coeff_data[j][i])<<2) >= u_threshold )
can_skip = false;
} }
cblock.SetSkip( can_skip );
}

From the error message I'd say that m_coeff_data is an array of doubles. std:abs is overloaded and will return a double and thus a double is being sent to the shift operator. This is not possible. Without knowing the intent of the person writing the code it is hard to say what the "right" solution is, but you can always cast (insert bug here) the result of the std:abs() call to an int. If you do this use a C++ cast please and not a C-style cast.

and another one:-
quant_chooser.cpp: In member function 'dirac::CoeffType
dirac::QuantChooser::BlockAbsMax(const dirac::Subband&)':
quant_chooser.cpp:358:64: error: no matching function for call to
'max(int&, __gnu_cxx::__enable_if<true, double>::__type)'
In line 358 where the last ) before ; is column 64:-
val = std::max( val , std::abs(m_coeff_data[j][i]) );
In function
CoeffType QuantChooser::BlockAbsMax( const Subband& node )
{
int val( 0 );

for (int j=node.Yp() ; j<node.Yp()+node.Yl(); ++j)
{
for (int i=node.Xp() ; i<node.Xp()+node.Xl(); ++i)
{ val = std::max( val , std::abs(m_coeff_data[j][i]) );
}// i
}// j

return val;
}

Same problem, data type incompatibility, std:max() is being called with an int (val) and a double (std:abs(m_ceff_data[i][j])); but there is no implementation of std:max(int, double), max only works for equal types, i.e. std:max(int, int) or std:max(double,double). You'll have to cast (insert bug here) one of the types.

HTH,
Robert
Can anyone tell me what's wrong, I don't understand the gcc output at
all, the package has failed for 45 days apparently, the 11.2 build is fine.
Thanks
Dave P

--
Robert Schweikert MAY THE SOURCE BE WITH YOU
Software Engineer Consultant LINUX
rschweikert@xxxxxxxxxx
781-464-8147

Novell
Making IT Work As One
--
To unsubscribe, e-mail: opensuse-packaging+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-packaging+help@xxxxxxxxxxxx

< Previous Next >
References