When I run truffle compile I am getting this error:
/home/user/truffle/contracts/Hello-world.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.15;
^----------------------^
,/home/user/truffle/contracts/Hello-world.sol:7:4: SyntaxError: No visibility specified. Did you intend to add "public"?
function Hello_world() {
^ (Relevant source part starts here and spans across multiple lines).
Compilation failed. See above.
I added public keyword and tried again:
pragma solidity ^0.4.15;
contract Hello {
string public message;
public function Hello_world() {
message = "Hello World!";
}
}
No use
sudo truffle compile
Error parsing /home/user/truffle/contracts/Hello-world.sol: ParsedContract.sol:7:4: ParserError: Function, variable, struct or modifier declaration expected.
public function Hello_world() {
^----^
Compilation failed. See above.