EOSIO / eosio.cdt

EOSIO.CDT (Contract Development Toolkit) is a suite of tools used to build EOSIO contracts
http://eosio.github.io/eosio.cdt
MIT License
512 stars 288 forks source link

Compile 'biginteger-for-eosio' error by eosio.cdt #302

Closed Tar-Palantir closed 5 years ago

Tar-Palantir commented 5 years ago

I use a external library in my contract - biginteger-for-eosio. But when I compile my contract code, it shows wasm error:

~/Projects/Server/contracts/chain# eosio-cpp -abigen chain.cpp -o chain.wasm
/usr/local/Cellar/eosio.cdt/1.4.1/opt/eosio.cdt/bin/wasm-ld: error: chain.wasm: undefined symbol: BigUnsigned::BigUnsigned(unsigned long)
/usr/local/Cellar/eosio.cdt/1.4.1/opt/eosio.cdt/bin/wasm-ld: error: chain.wasm: undefined symbol: BigUnsigned::operator*(BigUnsigned const&) const
/usr/local/Cellar/eosio.cdt/1.4.1/opt/eosio.cdt/bin/wasm-ld: error: chain.wasm: undefined symbol: BigUnsigned::operator&(BigUnsigned const&) const
/usr/local/Cellar/eosio.cdt/1.4.1/opt/eosio.cdt/bin/wasm-ld: error: chain.wasm: undefined symbol: BigUnsigned::operator%(BigUnsigned const&) const
/usr/local/Cellar/eosio.cdt/1.4.1/opt/eosio.cdt/bin/wasm-ld: error: chain.wasm: undefined symbol: BigUnsigned::toUnsignedInt() const
/usr/local/Cellar/eosio.cdt/1.4.1/opt/eosio.cdt/bin/wasm-ld: error: chain.wasm: undefined symbol: BigUnsignedInABase::BigUnsignedInABase(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned short)
/usr/local/Cellar/eosio.cdt/1.4.1/opt/eosio.cdt/bin/wasm-ld: error: chain.wasm: undefined symbol: BigUnsignedInABase::operator BigUnsigned() const
Warning, empty ricardian clause file
Warning, empty ricardian clause file
Warning, action <init> does not have a ricardian contract
Warning, action <test> does not have a ricardian contract

Then I tried that I add the library code files to compile, like this:

~/Projects/Server/contracts/chain# eosio-cpp -abigen -o chain.wasm chain.cpp eos_mem_wrapper.cpp BigInteger.cpp BigIntegerAlgorithms.cpp BigIntegerUtils.cpp BigUnsigned.cpp BigUnsignedInABase.cpp
clang-7: error: cannot specify -o when generating multiple output files
/usr/local/Cellar/eosio.cdt/1.4.1/opt/eosio.cdt/bin/wasm-ld: error: chain.wasm: not a relocatable wasm file
Warning, empty ricardian clause file
Warning, empty ricardian clause file
Warning, action <init> does not have a ricardian contract
Warning, action <test> does not have a ricardian contract

Even if I removed the option "-o chain.wasm", the error still show.

Tar-Palantir commented 5 years ago

I fixed by including all I used cpp files.