1
공유 포인터를 가져 와서 다른 공유 포인터로 설정하는 집합 함수를 만들려고합니다. C++ 공유 포인터 문제
이
내가 내 cpp에있는 그것을 구현하려고 할 때class Shape
{
public:
Shape();
Gdiplus::Point start;
Gdiplus::Point end;
std::shared_ptr<Gdiplus::Pen> m_pen;
virtual LRESULT Draw(Gdiplus::Graphics * m_GraphicsImage) = 0;
void setPen(std::shared_ptr<Gdiplus::Pen> pen2);
void setStart(int xPos, int yPos);
void setEnd(int xCor, int yCor);
};
는하지만 난 오류가 공유 포인터와 난 내 헤더 파일에 선언 한 설정 기능은 내 "선언과 호환되지 않는 것을 말하고있다 .h "에 선언 된 void setPen. 그것은 또한 m_pen이 내 cpp 파일에서 unedintified다는 것을 말한다.
#include<memory>
#include "stdafx.h"
#include "resource.h"
#include "ShapeMaker.h"
void Shape::setPen(std::shared_ptr<Gdiplus::Pen> pen2)
{
m_pen = pen2;
}
void Shape::setStart(int xPos, int yPos)
{
start.X = xPos;
start.Y = yPos;
}
void Shape::setEnd(int xCor, int yCor)
{
end.X= xCor;
end.Y = yCor;
}
그건 내가 가진 전부입니다. 내가 어떤 방문자에 대한 코멘트에서 내 대답을 게시하도록하겠습니다
shapemaker.h(11): error C2039: 'shared_ptr' : is not a member of 'std'
shapemaker.h(11): error C2143: syntax error : missing ';' before '<'
shapemaker.h(11): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
shapemaker.h(11): error C2238: unexpected token(s) preceding ';'
.h(16): error C2039: 'shared_ptr' : is not a member of 'std'
shapemaker.h(16): error C2061: syntax error : identifier 'shared_ptr'
shapemaker.cpp(9): error C2511: 'void Shape::setPen(std::tr1::shared_ptr<_Ty>)' : overloaded member function not found in 'Shape'
이 구현을 표시 할 수 있습니까? –
불평하는 행을 실제로 보아서 선언과 비교할 수 있으면 편리 할 것입니다. – chris
그것은 거기에 간다. 미안 해요 – user1665569