Error: No viable overloaded =

Your code should be

MemberListEntry * mEntry;
mEntry = new MemberListEntry(id, port);

You are allocating an object on heap using new operator which returns pointer to the object created and you are trying to assign a pointer to an object.

Better alternative here would be allocate object on stack which you are doing it already.

MemberListEntry mEntry(id, port);

This creates and initializes the object and it will be destructed automatically when your function goes out of scope.

Fun fact: This not java, it’s C++. 🙂

Hope this helps.

Leave a Comment