1

i don't know why i get this problem, anybody who can helps thanks a lot

pragma solidity ^0.4.21;

contract MathContract { function mulAtoB(uint a, uint b) pure public returns(uint) { return a * b; } }

Error parsing /Users/yuwei/Desktop/1110/demo1/abcd/contracts/Migrations.sol: ParsedContract.sol:7:14: ParserError: Expected identifier, got 'LParen' constructor() public {

YuweideMacBook-Air:abcd yuwei$ truffle version Truffle v4.1.4 (core: 4.1.4) Solidity v0.4.21 (solc-js)

2 Answers 2

1

The code you provided works just fine, assuming you have the right compiler version.

To verify, you can just copy+paste the code in Remix https://remix.ethereum.org and change the first line to be pragma solidity ^0.5.1; as that's the default compiler in Remix (I think).

1
  • no, there is the same error
    – YwD
    Aug 23, 2019 at 11:39
0

The code you provided works just fine for me, too. But the problem is in your Migrations contract. When using Truffle you should leave as it is was created by truffle init command, because it is required for proper Truffle work.

Your Answer

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

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