Aniseto / NosoWalletCPP

Noso Wallet implementation in C++
https://www.nosocoin.com
MIT License
2 stars 1 forks source link

Compilation having issues with type `byte` #6

Closed gcarreno closed 1 year ago

gcarreno commented 1 year ago

Hey @Aniseto,

Like I mentioned in Discord, this is the error messages I get when compiling:

#####
# Building NosoWalletCPP
#####
[ 25%] Building CXX object CMakeFiles/NosoWalletCPP.dir/NosoWalletCPP.cpp.o
/home/gcarreno/Programming/Noso/gcarreno-NosoWalletCPP/NosoWalletCPP.cpp: In member function ‘std::string MainFrame::PublicKeyToSHA256(const std::string&)’:
/home/gcarreno/Programming/Noso/gcarreno-NosoWalletCPP/NosoWalletCPP.cpp:389:15: error: ‘byte’ does not name a type; did you mean ‘wxByte’?
  389 |         const byte* publicKeyBytes = reinterpret_cast<const byte*>(publicKey.data());
      |               ^~~~
      |               wxByte
/home/gcarreno/Programming/Noso/gcarreno-NosoWalletCPP/NosoWalletCPP.cpp:394:9: error: ‘byte’ was not declared in this scope
  394 |         byte hash[CryptoPP::SHA256::DIGESTSIZE];
      |         ^~~~
/home/gcarreno/Programming/Noso/gcarreno-NosoWalletCPP/NosoWalletCPP.cpp:394:9: note: suggested alternatives:
In file included from /usr/include/boost/config/compiler/gcc.hpp:165,
                 from /usr/include/boost/config.hpp:39,
                 from /usr/include/boost/asio/detail/config.hpp:26,
                 from /usr/include/boost/asio/associated_allocator.hpp:18,
                 from /usr/include/boost/asio.hpp:20,
                 from /home/gcarreno/Programming/Noso/gcarreno-NosoWalletCPP/Communication.h:3,
                 from /home/gcarreno/Programming/Noso/gcarreno-NosoWalletCPP/NosoWalletCPP.cpp:8:
/usr/include/c++/12/cstddef:69:14: note:   ‘std::byte’
   69 |   enum class byte : unsigned char {};
      |              ^~~~
In file included from /usr/include/cryptopp/config.h:27,
                 from /usr/include/cryptopp/eccrypto.h:10,
                 from /home/gcarreno/Programming/Noso/gcarreno-NosoWalletCPP/NosoWalletCPP.cpp:10:
/usr/include/cryptopp/config_int.h:56:23: note:   ‘CryptoPP::byte’
   56 | typedef unsigned char byte;
      |                       ^~~~
In file included from /usr/include/botan-2/botan/secmem.h:11,
                 from /usr/include/botan-2/botan/base58.h:10,
                 from /home/gcarreno/Programming/Noso/gcarreno-NosoWalletCPP/NosoWalletCPP.cpp:22:
/usr/include/botan-2/botan/types.h:89:7: note:   ‘Botan::byte’
   89 | using byte   = std::uint8_t;
      |       ^~~~
/home/gcarreno/Programming/Noso/gcarreno-NosoWalletCPP/NosoWalletCPP.cpp:395:23: error: ‘publicKeyBytes’ was not declared in this scope; did you mean ‘publicKeySize’?
  395 |         sha256.Update(publicKeyBytes, publicKeySize);
      |                       ^~~~~~~~~~~~~~
      |                       publicKeySize
/home/gcarreno/Programming/Noso/gcarreno-NosoWalletCPP/NosoWalletCPP.cpp:396:22: error: ‘hash’ was not declared in this scope
  396 |         sha256.Final(hash);
      |                      ^~~~
/home/gcarreno/Programming/Noso/gcarreno-NosoWalletCPP/NosoWalletCPP.cpp:396:22: note: suggested alternatives:
In file included from /usr/include/c++/12/string_view:43,
                 from /usr/include/c++/12/bits/basic_string.h:47,
                 from /usr/include/c++/12/string:53,
                 from /usr/include/wx-3.2/wx/stringimpl.h:66,
                 from /usr/include/wx-3.2/wx/unichar.h:15,
                 from /usr/include/wx-3.2/wx/strvararg.h:19,
                 from /usr/include/wx-3.2/wx/string.h:37,
                 from /usr/include/wx-3.2/wx/memory.h:15,
                 from /usr/include/wx-3.2/wx/object.h:19,
                 from /usr/include/wx-3.2/wx/wx.h:15,
                 from /home/gcarreno/Programming/Noso/gcarreno-NosoWalletCPP/NosoWalletCPP.cpp:3:
/usr/include/c++/12/bits/functional_hash.h:59:12: note:   ‘std::hash’
   59 |     struct hash;
      |            ^~~~
In file included from /usr/include/boost/shared_ptr.hpp:17,
                 from /usr/include/boost/date_time/time_clock.hpp:17,
                 from /usr/include/boost/date_time/posix_time/posix_time_types.hpp:10,
                 from /usr/include/boost/asio/time_traits.hpp:23,
                 from /usr/include/boost/asio/detail/timer_queue_ptime.hpp:22,
                 from /usr/include/boost/asio/detail/deadline_timer_service.hpp:29,
                 from /usr/include/boost/asio/basic_deadline_timer.hpp:25,
                 from /usr/include/boost/asio.hpp:25:
/usr/include/boost/smart_ptr/shared_ptr.hpp:1158:28: note:   ‘boost::hash’
 1158 | template< class T > struct hash;
      |                            ^~~~
/home/gcarreno/Programming/Noso/gcarreno-NosoWalletCPP/NosoWalletCPP.cpp: In member function ‘std::string MainFrame::CalculateMD160(const std::string&)’:
/home/gcarreno/Programming/Noso/gcarreno-NosoWalletCPP/NosoWalletCPP.cpp:413:5: error: ‘byte’ was not declared in this scope
  413 |     byte digest[CryptoPP::RIPEMD160::DIGESTSIZE];
      |     ^~~~
/home/gcarreno/Programming/Noso/gcarreno-NosoWalletCPP/NosoWalletCPP.cpp:413:5: note: suggested alternatives:
/usr/include/c++/12/cstddef:69:14: note:   ‘std::byte’
   69 |   enum class byte : unsigned char {};
      |              ^~~~
/usr/include/cryptopp/config_int.h:56:23: note:   ‘CryptoPP::byte’
   56 | typedef unsigned char byte;
      |                       ^~~~
/usr/include/botan-2/botan/types.h:89:7: note:   ‘Botan::byte’
   89 | using byte   = std::uint8_t;
      |       ^~~~
/home/gcarreno/Programming/Noso/gcarreno-NosoWalletCPP/NosoWalletCPP.cpp:415:26: error: ‘digest’ was not declared in this scope; did you mean ‘sigset’?
  415 |     hash.CalculateDigest(digest, reinterpret_cast<const byte*>(SHA256String.c_str()), SHA256String.length());
      |                          ^~~~~~
      |                          sigset
/home/gcarreno/Programming/Noso/gcarreno-NosoWalletCPP/NosoWalletCPP.cpp:415:57: error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]
  415 |     hash.CalculateDigest(digest, reinterpret_cast<const byte*>(SHA256String.c_str()), SHA256String.length());
      |                                                         ^~~~
/home/gcarreno/Programming/Noso/gcarreno-NosoWalletCPP/NosoWalletCPP.cpp:415:57: error: expected ‘>’ before ‘byte’
/home/gcarreno/Programming/Noso/gcarreno-NosoWalletCPP/NosoWalletCPP.cpp:415:57: error: expected ‘(’ before ‘byte’
  415 |     hash.CalculateDigest(digest, reinterpret_cast<const byte*>(SHA256String.c_str()), SHA256String.length());
      |                                                         ^~~~
      |                                                         (
/home/gcarreno/Programming/Noso/gcarreno-NosoWalletCPP/NosoWalletCPP.cpp:415:62: error: expected primary-expression before ‘>’ token
  415 |     hash.CalculateDigest(digest, reinterpret_cast<const byte*>(SHA256String.c_str()), SHA256String.length());
      |                                                              ^
gmake[2]: *** [CMakeFiles/NosoWalletCPP.dir/build.make:104: CMakeFiles/NosoWalletCPP.dir/NosoWalletCPP.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/NosoWalletCPP.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2

I also alerted @Azazorro to this problem via Discord.

Cheers, Gus

Aniseto commented 1 year ago

Just Changed using Botan library, test now as i think now will solve this issue. Now i use Botan::byte definiton.