Now I connect library SafeMath.sol in local project.

pragma solidity ^0.4.15;
   import './ERC20.sol';
   import './SafeMath.sol';

How can I connect SafeMath.sol from external(non-local) resources or other contracts?


When using import statements you need to have the actual files of the imported contracts as well. In your case, ./SafeMath.sol specifies to the compiler that the contract you are importing is in the same directory with your own contract.

Please see more regarding import paths in : How should we set a import path in solidity?

And in case you want to link your contract to a library: What are the steps to compile and deploy a library in Solidity?

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.