'I am having error : "Inbox" -- Invalid number of parameters for "undefined". Got 0 expected 1

I am writing a simple smart contract namely 'inbox.sol'. I am using truffle framework to test and deploy it to the rinkeby network using Infura API. I am having this error. Please help. I'm a beginner.

This is deployed contract in migration

This is my smart contract code

error i got



Solution 1:[1]

Your contract has a constructor and expects an argument.

constructor(string memory initialMessage) public {
        message = initialMessage;
    }

So when you deploy it you have to pass an argument.

const Inbox = artifacts.require("Inbox");

module.exports = function (deployer) {
  // passing an argument 
  deployer.deploy(Inbox, "myInitialMessage");
};

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yilmaz