[Ethereum] The solc is not generatig *.abi file with the option –abi and -o build

abisolcsolidity

When I use the –abi option, the abi interface is generated:

$ solc Greeter.sol --abi

======= Greeter.sol:mortal =======
Contract JSON ABI
[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"}]

But when I ask it to put it into the output folder, with -o build, the file is missing:

WHHA@NBVAL752 ~/dev/java-magazine-tutorial
$ solc Greeter.sol --abi -o build

WHHA@NBVAL752 ~/dev/java-magazine-tutorial
$ ls build/
Greeter.sol

WHHA@NBVAL752 ~/dev/java-magazine-tutorial
$ cat build/Greeter.sol

The only generated file is Greeter.sol which is emtpy.

The contract code is:

$ less Greeter.sol pragma solidity ^0.4.2;

contract mortal {  /* Define variable owner of the type address*/  address owner;  /* this function is executed at initialization  and sets the owner of the contract */ function mortal() { owner = msg.sender; }

/* Function to recover the funds on the  contract */  function kill() {  if (msg.sender == owner) suicide(owner);  } } Greeter.sol (END)

SOlc version is:

$ solc --version
solc, the solidity compiler commandline interface
Version: 0.4.9+commit.364da425.Windows.msvc

Any idea??

Best Answer

It seems like a command syntax issue. This works for me:

solc --abi greeter.sol -o build

Related Topic