Tuesday 15 May 2012

C++ shared pointer issue -


I am trying to create a set function which will take in a shared pointer and set it equal to another share indicator

This is a shared pointer and set function that I have declared on my header file

  class shape {public: shape (); Gdiplus :: Start Point; GDPlus :: Point & End; Std :: shared_ptr & lt; Gdiplus :: Pen & gt; M_pen; Virtual LRESULT Draw (Gdiplus :: Graphics * m_GraphicsImage) = 0; Zero Setpage (Study :: Shared APTR & lt; Gdiplus :: Pen & gt; pen2); Zero setstart (int x pos, int yPos); Zero set-end (int x core, int yCor); };   

But when I try to implement it in my CPP, I get an error saying that "My declaration is incompatible with zero setpane." It also says that m_pen is unedintified on my CPP file.

  #include & lt; Memory & gt; #include "stdafx.h" #include "resource.h" #include "ShapeMaker.h" zero size :: setPen (std :: shared_ptr & gt; gdiplus :: pen & gt; pen2) {m_pen = pen2; } Zero size :: setstart (int xPos, int yPos) {start.x = xPos; Start.Y = yPos; } Zero size :: set-end (int x core, int yCor) {end.x = xCor; End.Y = yCor; }   

It really is with me. Includes Stdax.h #include & lt; Atlwin.h & gt; #include & lt; Atlframe.h & gt; # Include & lt; Atlctrls.h & gt; # Include & lt; Atldlgs.h & gt; # Include & lt; Atlctrlw.h & gt; # Include & lt; Atlscrl.h & gt; # Include & lt; GdiPlus.h & gt;

Errors that I get:

  Size standard. (11): Error C2039: 'shared_ptr': 'STD' is not a member of the size h (11): Error C2143: syntax error: missing ';' '& Lt;' Before Shapemaker.h (11): Error C4430: Missing type specifier - int assumed. Note: C ++ default-int ordermaker. (11): Error C2238: Unexpected token predecessor ';' . (16): Error C2039: 'shared_ptr': 'STD' is not a member of shapemaker.h (16): Error C2061: Syntax Error: Identifier 'shared_ptr' shapemaker.cpp (9): Error C2511: 'Zero Size: SetPen (std :: tr1 :: shared_ptr & lt; _Ty & gt;): 'Overloaded member function' was not found in the size    

I am posting my reply to comments for any visitor.

The problem is at the beginning of the CPP file.

  #include & lt; Memory & gt; #include "stdafx.h" #include "resource.h" #include "ShapeMaker.h"   

MSVC ++ demands that the precompiled header "stdafx.h" It is necessary first.

No comments:

Post a Comment