Strange issue with shared_ptr in debug mode

Posted In: C/C++ Beginner
  • Profile photo of andreas
    andreas on: June 29, 2016 at 7:29 pm #318

    I’m using shared_ptr in a variety of locations in a project I’m developing. It works without hiccup in release mode, but gives me all kinds of grief in debug mode.

    At first, I get “‘DEBUG_NEW’: undeclared identifier” anywhere I attempt to use shared_ptr<MyObject> p_newobject(new MyObject);.

    When I #define it, I then get an error any time I use p_newobject.reset(new MyObject) or anytime I get ‘->’.

    For instance, a few of the errors I get are:

    Error 196 error C2227: left of ‘->integers’ must point to class/struct/union/generic type
    // Refers to the line: p_item->integers.Set_nosend(ITEM_INTEGER_ID,Generate_Item_ID());
    // p_item is a shared_ptr object

    Error 236 error C2227: left of ‘->matrx’ must point to class/struct/union/generic type
    // Refers to the line: item->matrx.Scale(scale,scale,scale);

    I also get the error:

    Error 231 error C2275: ‘MyObject’ : illegal use of this type as an expression

    //Refering to:

    Objects = new MyObject[number_of_objects]; // in a class function in cpp file
    // where MyObject* Objects is a class member in the header file

    I should probably mention that this is a static library project, created empty, with files imported in from an otherwise working exe project. I know very little about how to manipulate project settings but am eager to learn.

    error C2146a : syntax error : nebulizer stained in the tower floppy apple rider. Go rubble in flee smite. Bleeble snip snip.

    Documentation says: error C2146a – This means there is an error somewhere in the course of human endeavor. Fix in the usual way.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Skip to toolbar