Peerunity / Peerunity

Community Peercoin client to support Peershares later
http://www.peercoin.net
MIT License
45 stars 26 forks source link

OSX Build Error - kernelrecord.cpp:79:24: error: call to 'pow' is ambiguous #116

Closed brossi closed 10 years ago

brossi commented 10 years ago

The master branch is generating a compile error on OSX. I haven't had a chance to dig in deeper, so this may be a simple fix, but I wanted to put this out there in case someone had a chance to take a look.

I'll try to get to it in the morning so we can wrap up the 0.1.1 build and get it released.

/bin/sh ../share/genbuild.sh obj/build.h
g++ -c -mmacosx-version-min=10.5 -O3 -arch x86_64 -Wextra -Wno-sign-compare -Wno-invalid-offsetof -Wformat-security  -DMAC_OSX -DMSG_NOSIGNAL=0 -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6 -DUSE_UPNP=1 -DHAVE_BUILD_INFO -I"/Users/crypmade/Peerunity-deployments/Peerunity/src" -I"/Users/crypmade/Peerunity-deployments/Peerunity/src"/obj -I"/opt/local/include" -I"/opt/local/include/db48" -MMD -o obj/kernelrecord.o kernelrecord.cpp
In file included from kernelrecord.cpp:1:
In file included from /Users/crypmade/Peerunity-deployments/Peerunity/src/kernelrecord.h:4:
/Users/crypmade/Peerunity-deployments/Peerunity/src/uint256.h:358:39: warning: unused parameter 'nType' [-Wunused-parameter]
    unsigned int GetSerializeSize(int nType, int nVersion) const
                                      ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/uint256.h:358:50: warning: unused parameter 'nVersion' [-Wunused-parameter]
    unsigned int GetSerializeSize(int nType, int nVersion) const
                                                 ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/uint256.h:365:35: warning: unused parameter 'nType' [-Wunused-parameter]
    void Serialize(Stream& s, int nType, int nVersion) const
                                  ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/uint256.h:365:46: warning: unused parameter 'nVersion' [-Wunused-parameter]
    void Serialize(Stream& s, int nType, int nVersion) const
                                             ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/uint256.h:372:37: warning: unused parameter 'nType' [-Wunused-parameter]
    void Unserialize(Stream& s, int nType, int nVersion)
                                    ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/uint256.h:372:48: warning: unused parameter 'nVersion' [-Wunused-parameter]
    void Unserialize(Stream& s, int nType, int nVersion)
                                               ^
In file included from kernelrecord.cpp:3:
In file included from /Users/crypmade/Peerunity-deployments/Peerunity/src/wallet.h:9:
In file included from /Users/crypmade/Peerunity-deployments/Peerunity/src/main.h:9:
In file included from /Users/crypmade/Peerunity-deployments/Peerunity/src/bignum.h:12:
In file included from /Users/crypmade/Peerunity-deployments/Peerunity/src/util.h:37:
In file included from /Users/crypmade/Peerunity-deployments/Peerunity/src/netbase.h:10:
/Users/crypmade/Peerunity-deployments/Peerunity/src/serialize.h:153:43: warning: unused parameter 'a' [-Wunused-parameter]
inline unsigned int GetSerializeSize(bool a, int, int=0)                          { return sizeof(char); }
                                          ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/serialize.h:399:68: warning: unused parameter 'nType' [-Wunused-parameter]
unsigned int GetSerializeSize_impl(const std::vector<T, A>& v, int nType, int nVersion, const boost::true_type&)
                                                                   ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/serialize.h:399:79: warning: unused parameter 'nVersion' [-Wunused-parameter]
unsigned int GetSerializeSize_impl(const std::vector<T, A>& v, int nType, int nVersion, const boost::true_type&)
                                                                              ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/serialize.h:421:65: warning: unused parameter 'nType' [-Wunused-parameter]
void Serialize_impl(Stream& os, const std::vector<T, A>& v, int nType, int nVersion, const boost::true_type&)
                                                                ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/serialize.h:421:76: warning: unused parameter 'nVersion' [-Wunused-parameter]
void Serialize_impl(Stream& os, const std::vector<T, A>& v, int nType, int nVersion, const boost::true_type&)
                                                                           ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/serialize.h:444:61: warning: unused parameter 'nType' [-Wunused-parameter]
void Unserialize_impl(Stream& is, std::vector<T, A>& v, int nType, int nVersion, const boost::true_type&)
                                                            ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/serialize.h:444:72: warning: unused parameter 'nVersion' [-Wunused-parameter]
void Unserialize_impl(Stream& is, std::vector<T, A>& v, int nType, int nVersion, const boost::true_type&)
                                                                       ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/serialize.h:677:42: warning: unused parameter 's' [-Wunused-parameter]
inline unsigned int SerReadWrite(Stream& s, const T& obj, int nType, int nVersion, CSerActionGetSerializeSize ser_action)
                                         ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/serialize.h:677:111: warning: unused parameter 'ser_action' [-Wunused-parameter]
inline unsigned int SerReadWrite(Stream& s, const T& obj, int nType, int nVersion, CSerActionGetSerializeSize ser_action)
                                                                                                              ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/serialize.h:683:104: warning: unused parameter 'ser_action' [-Wunused-parameter]
inline unsigned int SerReadWrite(Stream& s, const T& obj, int nType, int nVersion, CSerActionSerialize ser_action)
                                                                                                       ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/serialize.h:690:100: warning: unused parameter 'ser_action' [-Wunused-parameter]
inline unsigned int SerReadWrite(Stream& s, T& obj, int nType, int nVersion, CSerActionUnserialize ser_action)
                                                                                                   ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/serialize.h:974:35: warning: unused parameter 'nType' [-Wunused-parameter]
    void Serialize(Stream& s, int nType, int nVersion) const
                                  ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/serialize.h:974:46: warning: unused parameter 'nVersion' [-Wunused-parameter]
    void Serialize(Stream& s, int nType, int nVersion) const
                                             ^
In file included from kernelrecord.cpp:3:
In file included from /Users/crypmade/Peerunity-deployments/Peerunity/src/wallet.h:9:
In file included from /Users/crypmade/Peerunity-deployments/Peerunity/src/main.h:9:
In file included from /Users/crypmade/Peerunity-deployments/Peerunity/src/bignum.h:12:
/Users/crypmade/Peerunity-deployments/Peerunity/src/util.h:209:46: warning: unused parameter 'pszName' [-Wunused-parameter]
void static inline EnterCritical(const char* pszName, const char* pszFile, int nLine, void* cs, bool fTry = false) {}
                                             ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/util.h:209:67: warning: unused parameter 'pszFile' [-Wunused-parameter]
void static inline EnterCritical(const char* pszName, const char* pszFile, int nLine, void* cs, bool fTry = false) {}
                                                                  ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/util.h:209:80: warning: unused parameter 'nLine' [-Wunused-parameter]
void static inline EnterCritical(const char* pszName, const char* pszFile, int nLine, void* cs, bool fTry = false) {}
                                                                               ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/util.h:209:93: warning: unused parameter 'cs' [-Wunused-parameter]
void static inline EnterCritical(const char* pszName, const char* pszFile, int nLine, void* cs, bool fTry = false) {}
                                                                                            ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/util.h:209:102: warning: unused parameter 'fTry' [-Wunused-parameter]
void static inline EnterCritical(const char* pszName, const char* pszFile, int nLine, void* cs, bool fTry = false) {}
                                                                                                     ^
In file included from kernelrecord.cpp:3:
In file included from /Users/crypmade/Peerunity-deployments/Peerunity/src/wallet.h:9:
In file included from /Users/crypmade/Peerunity-deployments/Peerunity/src/main.h:10:
In file included from /Users/crypmade/Peerunity-deployments/Peerunity/src/net.h:21:
/Users/crypmade/Peerunity-deployments/Peerunity/src/addrman.h:247:5: warning: unused parameter 'nVersion' [-Wunused-parameter]
    IMPLEMENT_SERIALIZE
    ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/serialize.h:76:46: note: expanded from macro 'IMPLEMENT_SERIALIZE'
    void Serialize(Stream& s, int nType, int nVersion) const  \
                                             ^
In file included from kernelrecord.cpp:3:
In file included from /Users/crypmade/Peerunity-deployments/Peerunity/src/wallet.h:9:
In file included from /Users/crypmade/Peerunity-deployments/Peerunity/src/main.h:10:
In file included from /Users/crypmade/Peerunity-deployments/Peerunity/src/net.h:21:
/Users/crypmade/Peerunity-deployments/Peerunity/src/addrman.h:247:5: warning: unused parameter 'nVersion' [-Wunused-parameter]
/Users/crypmade/Peerunity-deployments/Peerunity/src/serialize.h:87:48: note: expanded from macro 'IMPLEMENT_SERIALIZE'
    void Unserialize(Stream& s, int nType, int nVersion)  \
                                               ^
In file included from kernelrecord.cpp:3:
In file included from /Users/crypmade/Peerunity-deployments/Peerunity/src/wallet.h:9:
In file included from /Users/crypmade/Peerunity-deployments/Peerunity/src/main.h:11:
/Users/crypmade/Peerunity-deployments/Peerunity/src/script.h:44:50: warning: unused parameter 'a' [-Wunused-parameter]
    friend bool operator==(const CNoDestination &a, const CNoDestination &b) { return true; }
                                                 ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/script.h:44:75: warning: unused parameter 'b' [-Wunused-parameter]
    friend bool operator==(const CNoDestination &a, const CNoDestination &b) { return true; }
                                                                          ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/script.h:45:49: warning: unused parameter 'a' [-Wunused-parameter]
    friend bool operator<(const CNoDestination &a, const CNoDestination &b) { return true; }
                                                ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/script.h:45:74: warning: unused parameter 'b' [-Wunused-parameter]
    friend bool operator<(const CNoDestination &a, const CNoDestination &b) { return true; }
                                                                         ^
/Users/crypmade/Peerunity-deployments/Peerunity/src/script.h:380:40: warning: unused parameter 'b' [-Wunused-parameter]
    CScript& operator<<(const CScript& b)
                                       ^
In file included from kernelrecord.cpp:3:
In file included from /Users/crypmade/Peerunity-deployments/Peerunity/src/wallet.h:13:
In file included from /Users/crypmade/Peerunity-deployments/Peerunity/src/walletdb.h:9:
/Users/crypmade/Peerunity-deployments/Peerunity/src/base58.h:400:70: warning: unused parameter 'id' [-Wunused-parameter]
bool inline CBitcoinAddressVisitor::operator()(const CNoDestination &id) const { return false; }
                                                                     ^
kernelrecord.cpp:79:24: error: call to 'pow' is ambiguous
    double maxTarget = pow(2, 224);
                       ^~~
/usr/include/c++/4.2.1/cmath:365:3: note: candidate function
  pow(double __x, int __i)
  ^
/usr/include/c++/4.2.1/cmath:369:3: note: candidate function
  pow(float __x, int __n)
  ^
/usr/include/c++/4.2.1/cmath:373:3: note: candidate function
  pow(long double __x, int __n)
  ^
/usr/include/math.h:436:15: note: candidate function
extern double pow(double, double);
              ^
/usr/include/c++/4.2.1/cmath:357:3: note: candidate function
  pow(float __x, float __y)
  ^
/usr/include/c++/4.2.1/cmath:361:3: note: candidate function
  pow(long double __x, long double __y)
  ^
kernelrecord.cpp:83:31: error: call to 'pow' is ambiguous
    return target * coinAge / pow(2, 256);
                              ^~~
/usr/include/c++/4.2.1/cmath:365:3: note: candidate function
  pow(double __x, int __i)
  ^
/usr/include/c++/4.2.1/cmath:369:3: note: candidate function
  pow(float __x, int __n)
  ^
/usr/include/c++/4.2.1/cmath:373:3: note: candidate function
  pow(long double __x, int __n)
  ^
/usr/include/math.h:436:15: note: candidate function
extern double pow(double, double);
              ^
/usr/include/c++/4.2.1/cmath:357:3: note: candidate function
  pow(float __x, float __y)
  ^
/usr/include/c++/4.2.1/cmath:361:3: note: candidate function
  pow(long double __x, long double __y)
  ^
32 warnings and 2 errors generated.
make: *** [obj/kernelrecord.o] Error 1
thokon00 commented 10 years ago

Hi,

these two commits might take you further: https://github.com/FairCoinTeam/fair-coin/commit/7416d4cecbb765f24062e51f9bda9aa99d49cbd2

and

https://github.com/FairCoinTeam/fair-coin/commit/7bcf476df4253fb75cdb2c0f4a20be8b36aaafbd

regs Thomas

brossi commented 10 years ago

Awesome, thank you @thokon00 . I'll get those suggestions integrated and tested. I really appreciate it.

brossi commented 10 years ago

That fixed it. Running tests now to confirm that there aren't any other issues.