1

I'm looking to use a hpp file as an interface for multiple contracts. I've created a test contract and receiving a WASM compilation error. I based the test contract on the format used by eosio.token.cpp/hpp.

/usr/opt/eosio.cdt/1.6.1/bin/wasm-ld: error: duplicate symbol: testcts::test::testact(eosio::name)

defined in /tmp/test.cpp.o

defined in /tmp/test.cpp.o

test.hpp

#pragma once

#include <eosiolib/eosio.hpp>

using namespace eosio;

namespace testcts {
    class [[eosio::contract("testct")]] test : public contract {
        public:
            test(name receiver, name code, datastream<const char*> ds) : contract(receiver, code, ds) { }

            ACTION testact( name user );
    };
}

test.cpp

#include "test.hpp"

namespace testcts {
    void test::testact( name user ) {
        require_auth( user );
    }
}

bumped to the homepage by Community 2 days ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

0

For me the error disappears when I use the -o flag to explicitly specify output file:

eosio-cpp -o test.wasm test.cpp

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.