Import: "Source not found"

ajunge_majunge_m Posts: 4Member
Hi,
I'm importing a contract that is in another file, but I get: " Parser error: Source not found."

The file is in the same dir.
Any ideas?

Saludos
Andres

Comments

  • jesus666jesus666 Posts: 62Member admin
    What do you mean by "another file"? Can you describe what you're trying to do in a bit more detail.

    e.g. which software you're using (is it Mix? is it Geth? etc.), what contracts you're trying to compile, on what OS and so on
  • chrisethchriseth Posts: 170Member ✭✭✭
    The compiler does not proactively access your filesystem. You have to give all files which are part of your project explicitly.
  • KitTheKidKitTheKid Posts: 2Member
    chriseth said:

    The compiler does not proactively access your filesystem. You have to give all files which are part of your project explicitly.

    Can you be a bit more explicit? I am using the Ethereum CLI (I do not have the resources to install anything like Mix or Alethzero) and I am trying to use loadScript("myscript.js") to import the script I have written. I have written something very modular and I do not want to copy-paste a lot of things more than once.

    I know my code works, since the realtime compiler can use the modularity now (yay!) and that does not give any errors. Also, when I copy the web3 deploy things to my local chain, everything works fine. But for some reason, I cannot get it to work in a .js file, with import script.

    I would also be fine with an answer how to import anything into geth that I have compiled with the commandline solc command. I am rather noob-ish with the blockchain and such, but my boss wants me to build a prototype...
  • chrisethchriseth Posts: 170Member ✭✭✭
    I think geth does not support compiling multiple files. What I was talking about above was the Solidity commandline compiler "solc". If you run that, just provide all the files that will be used in the end as a commandline option.
    Another way would be to connect browser-solidity directly to your ethereum node.
  • KitTheKidKitTheKid Posts: 2Member
    Ah, thanks. Then it at least wasn't me ;)
  • gethprimegethprime Posts: 2Member
    edited March 2016
    I'm having the same issue as ajunge_m

    sale.sol:1:1: Parser Error: Source not found.
    import "mortal";
    ^--------------^

    The mortal contract is in the same directory as sale.sol
  • gethprimegethprime Posts: 2Member
    I think I figured out the issue, thanks for posting this on github chriseth.

    https://github.com/ethereum/solidity/issues/169
  • swapnilkumbhar079swapnilkumbhar079 Posts: 1Member
    edited July 11
    use import "./mortal.sol"; insted of import "mortal";
Sign In or Register to comment.