Помогите решить проблему: взял прогу из примеров для C++.NET, из-за моей среды пришлось переделать на С++/CLI. Запускаю выдает ошибки "LNK", которые сложно отследить
Код:
#include "stdafx.h"
#using<mscorlib.dll>
#using<System.Drawing.dll>
#using<System.Windows.Forms.dll>
using namespace System;
using namespace System::Drawing;
using namespace System::Windows::Forms;
using namespace System::Collections;
ref class ShapeObject abstract
{
public:
virtual void Initialize()=0;
virtual void Draw(Graphics ^poG)=0;
};
ref class LineObject : public ShapeObject
{
public:
virtual void Initialize() override;
virtual void Draw(Graphics ^poG) override;
private:
int m_nXFrom;
int m_nYFrom;
int m_nXTo;
int m_nYTo;
};
void LineObject::Initialize()
{
Console::WriteLine(L"Координата х начальной точки:");
m_nXFrom=Convert::ToInt32(Console::ReadLine());
Console::WriteLine(L"Координата y начальной точки:");
m_nYFrom=Convert::ToInt32(Console::ReadLine());
Console::WriteLine(L"Координата х конечной точки:");
m_nXTo=Convert::ToInt32(Console::ReadLine());
Console::WriteLine(L"Координата н конечной точки:");
m_nYTo=Convert::ToInt32(Console::ReadLine());
}
void LineObject::Draw(Graphics ^poG)
{
Pen ^poPen=gcnew Pen(Color::Red);
poG->DrawLine(poPen, m_nXFrom, m_nYFrom, m_nXTo, m_nYTo);
}
ref class CircleObject:public ShapeObject
{
public:
virtual void Initialize() override;
virtual void Draw(Graphics ^poG) override;
private:
int m_nXCenter;
int m_nYCenter;
int m_nRadius;
};
void CircleObject::Initialize()
{
Console::WriteLine(L"Координата х центра круга");
m_nXCenter=Convert::ToInt32(Console::ReadLine());
Console::WriteLine(L"Координата y центра круга");
m_nYCenter=Convert::ToInt32(Console::ReadLine());
Console::WriteLine(L"Радиус круга");
m_nRadius=Convert::ToInt32(Console::ReadLine());
}
void CircleObject::Draw(Graphics ^poG)
{
Pen ^poPen=gcnew Pen(Color::Blue);
poG->DrawEllipse(poPen, m_nXCenter-m_nRadius, m_nYCenter-m_nRadius, m_nXCenter+m_nRadius,m_nYCenter+m_nRadius);
}
ref class DisplayObject
{
public:
void Initialize();
void Add();
void Draw(Graphics ^poG);
DisplayObject();
private:
ArrayList ^m_paShapes;
};
void DisplayObject::Initialize()
{
m_paShapes=gcnew ArrayList();
}
void DisplayObject::Add()
{
bool fFinished=false;
String ^pszMore;
ShapeObject ^poShape;
while(!fFinished)
{
Console::WriteLine("Type c to create a circle or l to create a line");
pszMore=Console::ReadLine();
if(pszMore->Equals(L"c"))
{
poShape=gcnew CircleObject();
}
else
{
poShape=gcnew LineObject();
}
poShape->Initialize();
m_paShapes->Add(poShape);
Console::WriteLine("Нажми у, чтобы добавить линию или круг");
pszMore=Console::ReadLine();
if(!pszMore->Equals(L"y"))
{
fFinished=true;
}
}
}
void DisplayObject::Draw(Graphics ^poG)
{
IEnumerator ^poEnumerator=m_paShapes->GetEnumerator();
while(poEnumerator->MoveNext())
{
static_cast<ShapeObject^>(poEnumerator->Current)->Draw(poG);
}
}
#ifdef _UNICODE
int wmain(void)
#else
int main(void)
#endif
{
Form ^poForm=gcnew Form();
Graphics ^poGraphics=poForm->CreateGraphics();
DisplayObject ^poDisplay=gcnew DisplayObject();
poDisplay->Add();
poForm->SetDesktopLocation(0,0);
poForm->Show();
poDisplay->Draw(poGraphics);
delete poGraphics;
Application::Run(poForm);
}
Не хотелось бы просто так забить на всю прогу, но я уже не знаю, что делать