since bitcoin already requires c++11 compiler, so change the use of boost::assign::list_of to c++11 new {} style initialiser. This can fix compile errors with recent boost versions.
fix compile error on boost >= 1.55 #5166
pull microcai wants to merge 1 commits into bitcoin:master from microcai:master changing 1 files +10 −10-
microcai commented at 6:31 AM on October 29, 2014: none
-
1557197efb
fix compile error on boost >= 1.55
since bitcoin already requires c++11 compiler, so change the use of boost::assign::list_of to c++11 new {} style initialiser. This can fix compile errors with recent boost versions. -
theuni commented at 6:47 AM on October 29, 2014: member
Bitcoin does not use c++11. What's the boost compile error?
-
microcai commented at 8:37 AM on October 29, 2014: none
compiler says: ambiguous overload for ‘operator=’ (operand types are ‘std::vector<unsigned char>’ and ‘boost::assign_detail::generic_list<int>’)
-
laanwj commented at 8:49 AM on October 29, 2014: member
NACK. This causes compile errors on all of our compilers in Travis.
-
theuni commented at 9:14 AM on October 29, 2014: member
Dumb guess is that it doesn't like the single-element ones. Please give this a try:
diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 1ab2925..f1d52a8 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -153,9 +153,9 @@ public: vSeeds.push_back(CDNSSeedData("bitnodes.io", "seed.bitnodes.io")); vSeeds.push_back(CDNSSeedData("xf2.org", "bitseed.xf2.org")); - base58Prefixes[PUBKEY_ADDRESS] = list_of(0); - base58Prefixes[SCRIPT_ADDRESS] = list_of(5); - base58Prefixes[SECRET_KEY] = list_of(128); + base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, 0); + base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, 5); + base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1, 128); base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x04)(0x88)(0xB2)(0x1E); base58Prefixes[EXT_SECRET_KEY] = list_of(0x04)(0x88)(0xAD)(0xE4); @@ -216,9 +216,9 @@ public: vSeeds.push_back(CDNSSeedData("bluematt.me", "testnet-seed.bluematt.me")); vSeeds.push_back(CDNSSeedData("bitcoin.schildbach.de", "testnet-seed.bitcoin.schildbach.de")); - base58Prefixes[PUBKEY_ADDRESS] = list_of(111); - base58Prefixes[SCRIPT_ADDRESS] = list_of(196); - base58Prefixes[SECRET_KEY] = list_of(239); + base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, 111); + base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, 196); + base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1, 239); base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x04)(0x35)(0x87)(0xCF); base58Prefixes[EXT_SECRET_KEY] = list_of(0x04)(0x35)(0x83)(0x94); -
microcai commented at 9:28 AM on October 29, 2014: none
2014-10-29 17:14 GMT+08:00 Cory Fields notifications@github.com:
Dumb guess is that it doesn't like the single-element ones. Please give this a try:
diff --git a/src/chainparams.cpp b/src/chainparams.cppindex 1ab2925..f1d52a8 100644--- a/src/chainparams.cpp+++ b/src/chainparams.cpp@@ -153,9 +153,9 @@ public: vSeeds.push_back(CDNSSeedData("bitnodes.io", "seed.bitnodes.io")); vSeeds.push_back(CDNSSeedData("xf2.org", "bitseed.xf2.org"));
@@ -216,9 +216,9 @@ public: vSeeds.push_back(CDNSSeedData("bluematt.me", "testnet-seed.bluematt.me")); vSeeds.push_back(CDNSSeedData("bitcoin.schildbach.de", "testnet-seed.bitcoin.schildbach.de"));base58Prefixes[PUBKEY_ADDRESS] = list_of(0);- base58Prefixes[SCRIPT_ADDRESS] = list_of(5);- base58Prefixes[SECRET_KEY] = list_of(128);+ base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, 0);+ base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, 5);+ base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1, 128); base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x04)(0x88)(0xB2)(0x1E); base58Prefixes[EXT_SECRET_KEY] = list_of(0x04)(0x88)(0xAD)(0xE4);base58Prefixes[PUBKEY_ADDRESS] = list_of(111);- base58Prefixes[SCRIPT_ADDRESS] = list_of(196);- base58Prefixes[SECRET_KEY] = list_of(239);+ base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, 111);+ base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, 196);+ base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1, 239); base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x04)(0x35)(0x87)(0xCF); base58Prefixes[EXT_SECRET_KEY] = list_of(0x04)(0x35)(0x83)(0x94);
— Reply to this email directly or view it on GitHub #5166 (comment).
negative, I got exactly 10 errors.
-
theuni commented at 9:18 PM on October 29, 2014: member
...and what are those errors? Please be sure to provide as much info as possible when reporting build issues.
-
microcai commented at 2:44 AM on October 30, 2014: none
...and what are those errors? Please be sure to provide as much info as possible when reporting build issues.
compiler says: ambiguous overload for ‘operator=’ (operand types are ‘std::vector’ and ‘boost::assign_detail::generic_list’)
- laanwj added the label Build system on Nov 3, 2014
-
theuni commented at 10:30 PM on November 24, 2014: member
Ok, I managed to track down the problem here. It's only an issue when building bitcoin in c++11 mode, which we don't yet support. Other than this issue, bitcoin seems to build fine as c++11.
I'm not quite sure what the correct fix is here. Here's a patch that just blindly fixes the problem: https://github.com/theuni/bitcoin/commit/b08ef0c736efab9f349df57d34883d8780f9009e
But if we're compiling for c++11, we don't need the list_of to begin with, we can just use the generic initialization syntax. So the other obvious fix would be to ifdef for c++11 which I'd rather not do, since we'll eventually be moving to that and requiring it.
So I think the most reasonable thing may be to take the patch above and forget about it, then the list_of's will go away after we switch to c++11.
-
gmaxwell commented at 10:41 PM on November 24, 2014: contributor
I'd like to understand how Microcai ended up compiling in C++11 mode in the first place?
- laanwj closed this on Dec 16, 2014
- MarcoFalke locked this on Sep 8, 2021