[Ethereum] ParserError: Expected token Semicolon got Lparen


This is my code (I use Remix ethereum):

emit Transfer(_initialOwner, _initialOwner, _initialAmount);

How can I fix it?

Best Answer

You are most likely using too old a compiler. You need at least version 0.4.21 for you syntax - before that version the emit keyword was not supported.

Also remember that just changing the first line of your code (the line where you specify the version) might not be enough as it's just a hint for the compiler - you also have to have the right version installed. If you use the latest remix.ethereum.org it should be fine, just use some of the latest compiler versions.

Related Topic