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 {}

1
  • Congratulations for asking the 1000th question on Ethereum Stack Exchange :-)
    – q9f
    Apr 4, 2016 at 21:06

3 Answers 3

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.

2
  • 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, 2016 at 20:43
  • Where do you found it? Apr 6, 2016 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.

0

Try adding .sol

import "someLib"

should be

import "someLib.sol"

see this issue for reference

2
  • 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.
    – q9f
    Apr 9, 2016 at 19:22
  • tried that, fully qualified, ... every permutation I could think of.
    – Walt D
    Apr 11, 2016 at 12:07

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.