solidity-stringutils icon indicating copy to clipboard operation
solidity-stringutils copied to clipboard

Question: Importing the Library

Open 360disrupt opened this issue 8 years ago • 4 comments

I try to import it like in the Readme

import "github.com/Arachnid/solidity-stringutils/strings.sol";

contract Mortal {
   ...

But when I try to build it with truffle I get this:

Cannot find import strings.sol from Test.sol. If it's a relative path, ensure it starts with `./` or `../`.
Compilation failed. See above.

How to do import it?

I read something here, that the compiler reads during dev from /usr/local/dapp-bin/library http://ethereum.stackexchange.com/questions/2137/how-should-we-set-a-import-path-in-solidity
So do I need to download the repo into that folder?

360disrupt avatar Oct 20 '16 14:10 360disrupt

How are you compiling this? github imports work fine in browser solidity, but if you're compiling from the command line, you should download the library and put it somewhere the compiler can reach, updating the import path to match.

Arachnid avatar Oct 20 '16 15:10 Arachnid

Thx, I do compile it from the command line. So I probably need to check out if I configure a libraries directory in truffle?

360disrupt avatar Oct 20 '16 15:10 360disrupt

Yes, whatever library support your framework has; putting it in the same directory will almost certainly work too.

Arachnid avatar Oct 20 '16 16:10 Arachnid