1

Terminal output me this error when I run:

solc --bin --asm c1.sol

pragma solidity ^0.4.11;

contract Cm {
    uint256 a;

    function Cm() {
        a = 1;
    }
}

solc --version --> 0.3.5-371690f0/Debug-Darwin/appleclang/Interpreter

I solved the problem removing the first line. Is no longer needed to define the solidity version?

1

Make sure to have the latest version of solc. Install documentation.

Here's how to install on macOS:

brew update
brew upgrade
brew tap ethereum/ethereum
brew install solidity
brew linkapps solidity

Run solc command to compile and save results to an output directory:

solc --bin --asm Example.sol -o build/

Generated files:

.
├── Example.sol
├── build
│   ├── Example.bin
│   └── Example.evm

Version tested with:

$ solc --version
solc, the solidity compiler commandline interface
Version: 0.4.18+commit.9cf6e910.Darwin.appleclang

Here are instruction for installing and using solcjs:

npm install -g solc@latest

Call the solcjs command with flags and smart contract filename:

solcjs --bin --abi Example.sol

It'll generate the corresponding files based on the flags you passed:

.
├── Example.sol
├── Example_sol_Example.abi
├── Example_sol_Example.bin

Version tested with:

$ solcjs --version
0.4.18+commit.9cf6e910.Emscripten.clang

Example solidity file used in all examples:

pragma solidity ^0.4.6;

contract Example {
  function add(uint a, uint b) returns (uint) {
    return a + b;
  }
}

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.