CryptoCoderz / Espers

An Experimental Blockchain Project
https://espers.io/
MIT License
79 stars 52 forks source link

Invalid declaration of 'cs_mapLocalHost' in net.cpp #25

Closed bitcoinx2 closed 6 years ago

bitcoinx2 commented 6 years ago

Compiling the headless version of Espers using makefile.unix fails with the following error:

net.cpp:39:25: error: ‘cs_mapLocalHost’ was declared ‘extern’ and later ‘static’ [-fpermissive]
 static CCriticalSection cs_mapLocalHost;
                         ^~~~~~~~~~~~~~~
In file included from net.cpp:8:0:
net.h:134:25: note: previous declaration of ‘cs_mapLocalHost’
 extern CCriticalSection cs_mapLocalHost;
                         ^~~~~~~~~~~~~~~
net.cpp:40:40: error: ‘mapLocalHost’ was declared ‘extern’ and later ‘static’ [-fpermissive]
 static map<CNetAddr, LocalServiceInfo> mapLocalHost;
                                        ^~~~~~~~~~~~
In file included from net.cpp:8:0:
net.h:135:40: note: previous declaration of ‘mapLocalHost’
 extern map<CNetAddr, LocalServiceInfo> mapLocalHost;
                                        ^~~~~~~~~~~~
In file included from util.h:16:0,
                 from chainparams.h:11,
                 from net.cpp:6:
tinyformat.h: In static member function ‘static const char* tinyformat::detail::FormatIterator::streamStateFromFormat(std::ostream&, unsigned int&, const char*, int, int)’:
tinyformat.h:785:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
             out.setf(std::ios::uppercase);
             ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
tinyformat.h:786:9: note: here
         case 'x': case 'p':
         ^~~~
tinyformat.h:791:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
             out.setf(std::ios::uppercase);
             ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
tinyformat.h:792:9: note: here
         case 'e':
         ^~~~
tinyformat.h:797:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
             out.setf(std::ios::uppercase);
             ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
tinyformat.h:798:9: note: here
         case 'f':
         ^~~~
tinyformat.h:802:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
             out.setf(std::ios::uppercase);
             ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
tinyformat.h:803:9: note: here
         case 'g':
         ^~~~
makefile.unix:202: recipe for target 'obj/net.o' failed
make: *** [obj/net.o] Error 1

System is GCC 7 on Ubuntu 18.04.

More info about the general error here: https://stackoverflow.com/questions/40419244/error-extern-and-later-static

CryptoCoderz commented 6 years ago

Issue resolved with commit: https://github.com/CryptoCoderz/Espers/commit/e2f3c41fb0d2e08ce0a89f00ebf18c6016562ef0

Espers v0.8.7.3 Update-0 Patch-6

Changelog