7

Working in the MIX environment, I'd like to try using a libraries and contracts defined in different files. However, the main contract always gets an error from MIX, no matter how I define the "import". The error is:

C:/TryImport/MainContract.sol Error: Source not found: File not supplied initially.

If I move the library into the contract file as a test, it compiles and works.

File someLib.sol

library someLib {...}

File MainContract.sol

import "someLib"

contract MainContract {}

  • Congratulations for asking the 1000th question on Ethereum Stack Exchange :-) – soc1c Apr 4 '16 at 21:06
4

You can't import Truffle libraries to any contract in Mix. The thing is that Truffle use your imports to build an only .sol file, so the compiler doesn't import anything. If you want to debug your imports in Mix you should copy your libraries code in the same file than your other contracts.

  • 1
    Solidity supports imports (or so I thought), and that is what I'm asking about. Not Truffle imports (which btw it is discontinuing due to Solidity now supporting imports). – Walt D Apr 6 '16 at 20:43
  • Where do you found it? – arodriguezdonaire Apr 6 '16 at 20:46
4

So it turns out there is an issue in the current release...they have been notified.

The work around is to use the full path. I also didn't realize that the full path is case sensitive.

-1

Try adding .sol

import "someLib"

should be

import "someLib.sol"

see this issue for reference

  • 1
    Hi and welcome to Ethereum Stack Exchange! Are you sure this will work? Did you test that? Maybe you could add some explaination to your answer and tell why this is required. – soc1c Apr 9 '16 at 19:22
  • tried that, fully qualified, ... every permutation I could think of. – Walt D Apr 11 '16 at 12:07

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.