1

I'm trying to import a contract from GitHub:

pragma solidity ^0.4.18;
pragma experimental ABIEncoderV2;
pragma experimental "v0.5.0";

import "github.com/ethereum/dapp-bin/library/stringUtils.sol";

However, it says, Error: Could not find github.com/ethereum/dapp-bin/library/stringUtils.sol from any sources;. What am I doing wrong?

2
  • Where you doing it from(Truffle,remix,mist,parity etc..) ? I tried your code in remix , it does work for me ?
    – Rangesh
    Nov 13, 2017 at 11:48
  • I tried to compile it with Truffle 4.0.1. Do you believe it's a bug?
    – ulu
    Nov 13, 2017 at 19:28

1 Answer 1

1

The error is that solidity does not know the location of your import file(s).

Many solutions to this. Simple one, git clone the dapp_bin and copy it to /usr/local

Now, invoke the compilation with

solc --optimize --combined-json abi,bin,interface github.com/ethereum/dapp_bin=/usr/local/dapp_bin <solidity file>

It includes a section to map the library to the section in your machine.

1
  • Well, of course, I can download it and use as a local file, that's not a problem. I thought maybe there was a way to skip this part. Looks like there isn't.
    – ulu
    Nov 23, 2017 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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