Error E0289: No instance of constructor "Movie::Movie" matches the argument list for a Basic Program (C++)

CodeZinx

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.

jkb

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};

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

C++ no instance of constructor matches the argument list e0289

How to fix an "no instance of constructor matches argument list" error in C++?

no instance of constructor matches the argument list

Error: No instance of constructor "Faktura::Faktura" matches the argument list

No instance of constructor "Hourly::Hourly" matches argument list and Error code C2664 on the same line

C++ template class: No instance of constructor matches the argument list

C++ no instance of constructor matches the argument list.

no instance of constructor "AcademicStaff::AcademicStaff" matches the argument list

C++/Threading : No instance of constructor "std::thread::thread" > matches the argument list

no instance of constructor "std::thread::thread" matches argument list

Simple Code Need Help - no instance of constructor matches argument list

Error passing Eigen matrix to a function in C++: "no instance of overloaded function matches the argument list"

c++ struct in map as value - error "no instance of overloaded function matches the argument list"

c++ getline() error, no instance of overload function "getline" matches the argument list

C++ 11 multi-thread merge sort with error “no instance of contructor 'std::thread' matches the argument list”

How can I fix a "no instance of function template 'Defer' matches the argument list" error in C++?

CUDA template error: no instance of function template matches the argument list

Error No instance of overloaded function "getline" matches the argument list

no instance of "getline" matches the argument list

C++ no instance of function template matches the argument list

no instance of overloaded function "std::make_unique" matches the argument list, but works with unique_ptr constructor

No instance of overloaded function matches the argument list

More than one instance of overloaded function matches the argument list and I can't find where the error happens

C++ No instance of overloaded function matches the argument list when calling std::replace()

C++ more than one instance of overloaded function matches the argument list when creating a header file

c++ template - More than one instance of overloaded function matches the argument list

C++ and SFML, no instance of the overloaded function "sf::RenderWindow.draw()" matches the argument list

c++ error no instance of constructor

no instance of constructor wxTextValidator matches instance