0
votes

So I have an error, I pinpointed it to this function. Nothing else seems to be the problem.

full error line:

word_driver.obj : error LNK2001: unresolved external symbol "public: class WORD & __thiscall WORD::operator=(class std::basic_string,class std::allocator > const &)" (??4WORD@@QAEAAV0@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)

WORD us;
    us = "abc";
    cout<<"Testing operator= by assignment the value of \"abc\" to use\n";
    cout<<us;

class WORD
{
public:

    WORD & operator=(const string &);
    WORD & operator=(const WORD &);

private:
    void AddChar(char);
    alpha_numeric *front;
};






    WORD & WORD::operator=(const WORD & org)
{

alpha_numeric *p;

    if (this != &org)
    {
        if (!Is_Empty())
        {
            while(front != 0)
            {
                p = front;
                front = front->next;
                delete p;
            }
        }

        for(p = org.front; p!=0; p=p->next)
        {
            AddChar(p->symbol);
        }
    }

    return *this;

}
1
I have other functions i'm commenting out to see if it's a problem there. - Ron
Note that the missing method is operator=(WORD const &) not operator=(const string &)`. That is the one you need to study, not the string one. - Raymond Chen
updated it with other operator= - Ron
Now you changed the error message. The new error message says that oprator=(string const &) is missing. Are you deleting one method when you add the other? Your declared both, you need to write both. Please stop changing the question. It invalidates previous answers. - Raymond Chen
I'm going to sleep now, I'll deal with this tomorrow. - Ron

1 Answers

0
votes

You are missing the definition for the operator= overload for WORD const &. Please paste the code that resulted in that compiler message.