by kvnsmnsn » 23 Oct 2010 04:43
Okay, I've gotten past all the _external_ things that were trying to keep me from building Shareaza. There were a lot of minor compilation problems that I fixed too, but now I'm stuck with the following piece of code in "hashlib\utility.hpp":
//! \brief generic function to swap the byte ordering of a given type
//!
//! The byte ordering can be swapped meaningfully only for unsigned integer types
//! therefore specializations are provided only for those types. We use
//! template specialization in order to avoid automatic argument conversion.
template<typename T>
struct SwapEndianess {};
template<> struct SwapEndianess< uint8 >
{
uint8 operator()(uint8 value) const { return value; }
};
template<> struct SwapEndianess< uint16 >
{
uint16 operator()(uint16 value) const
{
return _byteswap_ushort( value );
}
};
template<> struct SwapEndianess< uint32 >
{
uint32 operator()(uint32 value) const
{
return _byteswap_ulong( value );
}
};
template<> struct SwapEndianess< uint64 >
{
uint64 operator()(uint64 value) const
{
return _byteswap_uint64( value );
}
};
template<typename T>
inline T swapEndianess(T value)
{
return SwapEndianess< T >()( value ); // <--- Error!
}
I added the little comment there at the end to point to the place the compiler is complaining about. The compiler message is,
"1>c:<pathname>\shareaza\hashlib\utility.hpp(221): error C2064: term does not evaluate to a function taking 1 arguments". I posted this problem to "comp.lang.c++", and somebody there suggested I change the original "struct SwapEndianess {};" to "struct SwapEndianess;". When I did that the compiler still complained at the same line saying, "1>c:\<path>\shareaza\hashlib\utility.hpp(221): er_ror C2514: 'SwapEndianess<T>' : class has no constructors". At this point the poster who made the suggestion threw up his arms. He did say, "*If* the original source once compiled but doesn't now, I think you have configuration issues." That's kind of the whole assumption I've been making this whole time, that "the original source once compiled but doesn't now." So can somebody out there tell me what I need to do with this segment of code, or with the configuration issues, so that I can get Shareaza to build?
Kevin S