K
KevinSimonson
I'm currently trying to use Visual Studio 2010 to build Shareaza, a
piece of open source software that theoretically should just build
from the C++ files without any problems. But when I attempted to
build it I got the following two error messages:
1>c:\<path-name>\shareaza\hashlib\utility.hpp(348): error C2664:
'_BitScanReverse' : cannot convert parameter 1 from 'uint32 *' to
'DWORD *'
1> Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
1>c:\<path-name>\shareaza\hashlib\utility.hpp(370): error C2664:
'_BitScanForward' : cannot convert parameter 1 from 'uint32 *' to
'DWORD *'
1> Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
1>
1>Build FAILED.
I took a look at the vicinity of lines 348 and 370 and got
345: inline uint32 highestBitSet(uint32 value)
346: {
347: uint32 index;
348: return _BitScanReverse( &index, value ) ? index : 0;
349: }
and
367: inline uint32 lowestBitSet(uint32 value)
368: {
369: uint32 index;
370: return _BitScanForward( &index, value ) ? index : 0;
371: }
and I looked <_BitScanReverse()> and <_BitScanForward()> up on the
Internet (at "http://msdn.microsoft.com/en-us/library/fbxyd7zd(VS.
80%29.aspx" and "http://msdn.microsoft.com/en-us/library/wfd9z0bb(VS.
80%29.aspx") and got:
unsigned char _BitScanReverse(
unsigned long * Index,
unsigned long Mask
);
and
unsigned char _BitScanForward(
unsigned long * Index,
unsigned long Mask
);
In view of these definitions, can anyone tell me (1) why this code is
generating these error messages, and (2) if it should be generating
these error messages, why it could _ever_ have compiled on _any_ C++
compiler. I remind you that I copied this code from an open source
repository; theoretically this code has already been compiled to
generate a working executable.
I look at this code and I think, all I really have to do is change the
type of each <index> variable from <unit32> to <unsigned long>. Is
that naive? Might I run into some unforeseen problems if I do that?
I'm a little hesitant to tweak the code, since I've been led to
believe that it was supposed to be working code before I downloaded
it. So what do you think? Should I tweak the code or should I try to
find some _other_ way to get this code working?
Kevin S
piece of open source software that theoretically should just build
from the C++ files without any problems. But when I attempted to
build it I got the following two error messages:
1>c:\<path-name>\shareaza\hashlib\utility.hpp(348): error C2664:
'_BitScanReverse' : cannot convert parameter 1 from 'uint32 *' to
'DWORD *'
1> Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
1>c:\<path-name>\shareaza\hashlib\utility.hpp(370): error C2664:
'_BitScanForward' : cannot convert parameter 1 from 'uint32 *' to
'DWORD *'
1> Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
1>
1>Build FAILED.
I took a look at the vicinity of lines 348 and 370 and got
345: inline uint32 highestBitSet(uint32 value)
346: {
347: uint32 index;
348: return _BitScanReverse( &index, value ) ? index : 0;
349: }
and
367: inline uint32 lowestBitSet(uint32 value)
368: {
369: uint32 index;
370: return _BitScanForward( &index, value ) ? index : 0;
371: }
and I looked <_BitScanReverse()> and <_BitScanForward()> up on the
Internet (at "http://msdn.microsoft.com/en-us/library/fbxyd7zd(VS.
80%29.aspx" and "http://msdn.microsoft.com/en-us/library/wfd9z0bb(VS.
80%29.aspx") and got:
unsigned char _BitScanReverse(
unsigned long * Index,
unsigned long Mask
);
and
unsigned char _BitScanForward(
unsigned long * Index,
unsigned long Mask
);
In view of these definitions, can anyone tell me (1) why this code is
generating these error messages, and (2) if it should be generating
these error messages, why it could _ever_ have compiled on _any_ C++
compiler. I remind you that I copied this code from an open source
repository; theoretically this code has already been compiled to
generate a working executable.
I look at this code and I think, all I really have to do is change the
type of each <index> variable from <unit32> to <unsigned long>. Is
that naive? Might I run into some unforeseen problems if I do that?
I'm a little hesitant to tweak the code, since I've been led to
believe that it was supposed to be working code before I downloaded
it. So what do you think? Should I tweak the code or should I try to
find some _other_ way to get this code working?
Kevin S