2

I have a following interface function:

pragma solidity ^0.4.24;

interface myInterface {

function registerUser(string memory email) public
      return (bool success);
}

contract myContract is myInterface {
    function registerUser(string memory email) public
      return (bool success){
         //some code ...
      }
    }
}

When I compile the smart contract using solc, I get following warning message:

Warning: Functions in interfaces should be declared external.
    function registerUser(string memory email,
    ^ (Relevant source part starts here and spans across multiple lines).

Later, based on following link's recommendation, I have replaces public keyword with external and obtained following error message:

Error: Location has to be calldata for external functions (remove the "memory" or "storage" keyword).
    function registerUser(string memory email,

After I have replaced public keyword with external keyword, I have obtained following error message.

Error: Function overload clash during conversion to external types for arguments.
    function registerUser(string email,
    ^ (Relevant source part starts here and spans across multiple lines).

[Q] How could I fix this warning message?

1

Error: Function overload clash during conversion to external types for arguments.

For this error make sure you also define it external when calling from another contract. because belove code works fine without any error.

pragma solidity ^0.4.24;

interface myInterface {

function registerUser(string email) external
      returns (bool success);
}

contract myContract is myInterface {
    function registerUser(string  email) external
      returns (bool success){
         //some code ...
      }
    }
  • Original function actually takes more than one argument, that's why it causes following error after I made the changes,: Compiler error: Stack too deep, try removing local variables.; I guess I have to stick to warning message. – alper Feb 12 at 7:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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