1

This is my code (I use Remix ethereum):

emit Transfer(_initialOwner, _initialOwner, _initialAmount);

How can I fix it?

1
  • 2
    please show us some more lines from above that emit ...? Commented Jun 13, 2018 at 14:14

2 Answers 2

5

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.

1

You have to perform two things

  • Change the pragma version to 0.4.21
  • Change the compiler version in the remix editor [It would be in the right side of the editor, select "0.4.21+commit.dfe3193c"]

As the other user said, you need to use the higher version

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.