Ramy
Ramy

Reputation: 174

Unresolved external symbols- Just after update to vss2015

i'am facing with an big problem. After update my files to visual studio 2015 i get an unresolved external symbols

This is main function.

void SpherePack::LostChild(SpherePack *t)
{
    assert(mChildCount);
    assert(mChildren);

#ifdef _DEBUG  // debug validation code.

    SpherePack *pack = mChildren;
    bool found = false;
    while (pack)
    {
        if (pack == t)
        {
            assert(!found);
            found = true;
        }
        pack = pack->_GetNextSibling();
    }
    assert(found);

#endif

    // first patch old linked list.. his previous now points to his next
    SpherePack *prev = t->_GetPrevSibling();

    if (prev)
    {
        SpherePack *next = t->_GetNextSibling();
        prev->SetNextSibling(next); // my previous now points to my next
        if (next) next->SetPrevSibling(prev);
        // list is patched!
    }
    else
    {
        SpherePack *next = t->_GetNextSibling();
        mChildren = next;
        if (mChildren) mChildren->SetPrevSibling(0);
    }

    mChildCount--;

    if (!mChildCount && HasSpherePackFlag(SPF_SUPERSPHERE))
    {
        mFactory->Remove(this);
    }
}

error

I added an photo with the complet error. Note: In debug mode all work fine. I don't have this error. Just in distribute mode.

This issue apper after changed from visual studio 2013 to 2015. In 2013 all work fine

Upvotes: 2

Views: 149

Answers (1)

Fabio Ceconello
Fabio Ceconello

Reputation: 16049

LostChild is declared as inline in SpherePack.h but is defined in SpherePack.cpp, which means it won't be accessible outside it. Now, Unlink (which is inlined in SpherePack.h) calls LostChild; so, if you call Unlink outside SpherePack.cpp (directly or not) you'll have the undefined error for LostChild as a result.

The reason for the error not appearing in debug mode is that inlining is disabled then, so you do have code generated for LostChild in SpherePack.obj. I don't know why it didn't happen in the previous VS release, but my guess is the same reason. Probably your setup there was such that inlining was disabled.

You can solve this problem by either declaring LostChild as non-inline or moving its implementation from SpherePack.cpp to SpherePack.h

Upvotes: 1

Related Questions