-1

I have no idea why I'm getting this error on this basic program. I even checked the code and searched this site and Google for answers. I don't understand how to fix my error though.

LINKS:
E0289 : No instance of constructor "Phone::Phone" matches the argument list?
no instance of constructor matches the argument list
Error: No instance of constructor matches the argument list

Here is my code:

#include <iostream>
#include <cmath>
#include <string>
#include <iomanip>
#include "trimdecimal.h"

using namespace std;

class Movie {
    public:
        string title;
        string director;
        string mainCast1;
        string mainCast2;
        int yearReleased;
        bool isAHit;
        int publicLikePercentage;
};

int main()
{
    Movie movie1 = Movie("Fast & Furious Presents: Hobbs & Shaw", "David Leitch", "Dwayne Johnson", "Jason Statham", 2019, true, 89);
}

And I am getting this error as I stated in the title:

E0289     no instance of constructor "Movie::Movie" matches the argument list

I coded this on Visual Studio 2019

Any solutions? I will wholeheartedly appreciate any fixes but please be specific and explain to me how to solve it like how you'd do to a child.

CodeZinx
  • 49
  • 1
  • 7
  • 2
    Where do you have a constructor that accepts 7 values as arguments? Actually, where have you defined any constructor at all? – Ken White Dec 12 '19 at 00:48

1 Answers1

0

You have not defined a constructor for your Movie class that takes those values as parameters.

If you're trying to just initialize the object by members, use {} instead of ():

Movie movie1 = Movie{"Fast & Furious Presents: Hobbs & Shaw", "David Leitch", "Dwayne Johnson", "Jason Statham", 2019, true, 89};

or just

Movie movie1 = {"Fast & Furious Presents: Hobbs & Shaw", "David Leitch", "Dwayne Johnson", "Jason Statham", 2019, true, 89};
jkb
  • 2,376
  • 1
  • 9
  • 12