1

I was trying to compile an example contract as told in the official website: here

it was successful to setSolc and getCompilers ,but some errors occur when compiling the contract available on that website:

var greeterSource = 'contract mortal { address owner; function mortal() { owner = msg.sender; } function kill() { if (msg.sender == owner) selfdestruct(owner); } } contract greeter is mortal { string greeting; function greeter(string _greeting) public { greeting = _greeting; } function greet() constant returns (string) { return greeting; } }'

undefined

var greeterCompiled = web3.eth.compile.solidity(greeterSource) Error: solc: exit status 1

at web3.js:3119:20
at web3.js:6023:15
at web3.js:4995:36
at <anonymous>:1:23

greeterSource = 'contract mortal { address owner; function mortal() { owner = msg.sender; } function kill() { if (msg.sender == owner) selfdestruct(owner); } } contract greeter is mortal { string greeting; function greeter(string _greeting) public { greeting = _greeting; } function greet() constant returns (string) { return greeting; } }' "contract mortal { address owner; function mortal() { owner = msg.sender; } function kill() { if (msg.sender == owner) selfdestruct(owner); } } contract greeter is mortal { string greeting; function greeter(string _greeting) public { greeting = _greeting; } function greet() constant returns (string) { return greeting; } }"

greeterCompiled = web3.eth.compile.solidity(greeterSource)

Error: solc: exit status 1 at web3.js:3119:20 at web3.js:6023:15 at web3.js:4995:36 at :1:19

var greeterCompiled = web3.eth.compile.solidity(greeterSource)

Error: solc: exit status 1 at web3.js:3119:20 at web3.js:6023:15 at web3.js:4995:36 at :1:23

1

check your compiler firstly.

eth.getCompilers()

and then set Compilers by this way:

admin.setSolc("/usr/local/bin/solc")

or add this option when you start geth

--solc /usr/local/bin/solc

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.