Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fail to import the sol in parent path #4914

Closed
ayeteng opened this issue Sep 6, 2018 · 1 comment
Closed

fail to import the sol in parent path #4914

ayeteng opened this issue Sep 6, 2018 · 1 comment

Comments

@ayeteng
Copy link

ayeteng commented Sep 6, 2018

Description

import sol file doesn't work with parent path set.
example:

solc --abi --bin --overwrite n1.sol -o /Users/sam/work/car/contracts/storage/compiled
n1.sol:4:1: Error: Source "CMEnabled.sol" not found: File not found.
import "../CMEnabled.sol";

but if I change the import path to ./ and add the file in the same path.

solc --abi --bin --overwrite CMCEnabled.sol -o /Users/samteng/work/car/contracts/compiled

import "./CMEnabled.sol";

Environment

  • Compiler version:

solc --version
solc, the solidity compiler commandline interface
Version: 0.4.24+commit.e67f0147.Darwin.appleclang

  • Operating system:
    OSX 10.13.6

Steps to Reproduce

solc --abi --bin --overwrite n1.sol -o /Users/sam/work/car/contracts/storage/compiled
n1.sol:4:1: Error: Source "CMEnabled.sol" not found: File not found.
import "../CMEnabled.sol";

Please provide a minimal source code example to trigger the bug you have found.
Please also mention any command line flags that are necessary for triggering the bug.
Provide as much information as necessary to reproduce the bug.

pragma solidity ^0.4.24;

import "./utility.sol";
import "../CMEnabled.sol";
@chriseth
Copy link
Contributor

chriseth commented Sep 6, 2018

I'm sorry, but importing from the parent path is not supported like that, because it would not be possible to generate a virtual directory structure to be used internally by the compiler. Please use remappings (and import from global virtual paths) or restructure your code layout so that this is not required.

Created an issue to track documentation: #4915

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants