Closed osoese closed 6 years ago
@osoese you did not forget to delete the lines? `#ifndef TESTCHAIN_BLOCK_H
...
similarly on g++ at me all was compiled
@AlexNickrodef I did not include those lines. I didn't use repo just wrote the code as I went through your write up then compared to repo. I also did not start with canned IDE code just a text editor and compile using gcc and g++. Thank you for the reply.
If you clone the repo and compile with the following command without making any changes to the code:
gcc -lstdc++ \
-o TestChain \
-std=c++11 \
-stdlib=libc++ \
-x c++ \
main.cpp Block.cpp Blockchain.cpp sha256.cpp
If you use "g++" compiler, this command g++ -std=c++11 main.cpp Block.cpp Blockchain.cpp sha256.cpp -o TestChain
would work.
1) Block.cpp:6:23: error: 'time' was not declared in this scope _tTime = time(NULL);
but the rest of these are puzzling me and I am not the best at C++ any ideas appreciated
2) C:\Users\\src\github.com\testchain>g++ -o testchain -std=c++11 main.cpp Block.cpp Blockchain.cpp sha256.cpp
Block.cpp: In member function 'void Block::MineBlock(uint32_t)':
Block.cpp:44:12: error: 'sHash' was not declared in this scope
while (sHash.substr(0, nDifficulty) != str)
^
Block.cpp:56:32: error: 'sHash' was not declared in this scope
cout << "Block mined: " << sHash << endl;
^
Block.cpp: In member function 'std::__cxx11::string Block::_CalculateHash() const':
Block.cpp:66:18: error: aggregate 'std::stringstream ss' has incomplete type and cannot be defined
stringstream ss;
^