Closed
Description
I am trying to use the following C++ JSON library:
https://github.com/nlohmann/json
Below is the code I am trying to compile with eosio-cpp gda.cpp -o gda.wasm
#include <eosiolib/eosio.hpp>
#include <nlohmann/json.hpp>
#include <string>
using json = nlohmann::json;
class gda : public eosio::contract {
public:
explicit gda(action_name self) : contract(self) {}
// @abi action
void doit(const std::string action) {
json j = {
{"pi", 3.141},
{"happy", true},
{"name", "Niels"},
{"nothing", nullptr},
{"answer", {
{"everything", 42}
}},
{"list", {1, 0, 2}},
{"object", {
{"currency", "USD"},
{"value", 42.99}
}}
};
std::string d = j.dump();
}
};
EOSIO_ABI( gda, (doit) )
Below is the output from trying to compile:
/usr/local/eosio.wasmsdk/bin/wasm-ld: error: locale.cpp.o: undefined symbol: strftime_l
/usr/local/eosio.wasmsdk/bin/wasm-ld: error: memory.cpp.o: undefined symbol: __cxa_pure_virtual
/usr/local/eosio.wasmsdk/bin/wasm-ld: error: system_error.cpp.o: undefined symbol:__cxa_pure_virtual
If the j.dump() line is commented out, the contract will compile.
A similar issue has been raised on stackoverflow.
https://stackoverflow.com/questions/52350514/linking-issue-with-eosio-ld
I was directed here from: EOSIO/eos#5832
Metadata
Assignees
Labels
No labels