[Ethereum] No visibility specified. Defaulting to “public”. function Ownable() {}

contract-debuggingerc-20

I'm trying to learn how to create tokens using Solidity/MIST.

I have modified a pre existing contract on a functioning token but I am having an error whenever I insert it into Ropsten.

The contract code can be seen here (it pasted oddly into stackexchange)

https://pastebin.com/s6Wc5wMp

The error i'm getting is:

 No visibility specified. Defaulting to "public".
function Ownable() {
^Spanning multiple lines., 

Any help with this would be appreciated.

Best Answer

This is probably a duplicate but I'll leave it to others to confirm that.

The error is really a warning. It's simply saying that no visibility was specified, so it's going with the default. This has been related to security issues in contracts - evidently, developers didn't realize their sensitive functions were open to "public". This error is added to more recent compilers to turn the dev's attention to a possible risk.

You can easily silence the warning by adding the modifier public:

function Ownable() public { ...

This won't change anything about the compiled code but it will signal the compiler that you are aware of the public visibility.

Hope it helps.

Related Topic