未解决的外部符号错误,mfc

时间:2012-10-31 23:27:57

标签: c++ mfc

这是我的代码。我无法弄清楚为什么我得到'未解决的外部符号'错误:

这里是整个消息:domaci1View.obj:错误LNK2001:未解析的外部符号“public:void __thiscall CDomaci1View :: Nacrtaj(类CDC *,类CRect,int * const,int,int,int,int)”(?Nacrtaj @ @@ CDomaci1View @@ QAEXPAVCDC @@ VCRect QAHHHHH @ Z

void CDomaci1View::OnDraw(CDC* pDC)
{
CDomaci1Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
RECT rect;
::GetClientRect(GetSafeHwnd(),&rect);


pDC->SelectStockObject(LTGRAY_BRUSH);
pDC->Rectangle(&rect);
//pravim okvirni
RECT okvirni;
CPen pravougaonikpen(PS_SOLID,2,RGB(201,202,202));
CBrush pravougaonik(RGB(172,171,171));
pDC->SelectObject(pravougaonikpen);
pDC->SelectObject(pravougaonik);
okvirni.left = rect.left +85;
okvirni.right = rect.right - 10;
okvirni.top = rect.top + 10;
okvirni.bottom = rect.bottom -71;
pDC->Rectangle(&okvirni);
    //brisem cektu i olovku

pravougaonik.DeleteObject();

//linije
pDC->SelectStockObject(BLACK_PEN);
int i = 1;
while (i!=6){
pDC->MoveTo(okvirni.left+1, i * okvirni.bottom/6);
pDC->LineTo(okvirni.right-2,i * okvirni.bottom/6);
i++;
}
// cetvorougao sa strane
pDC->SelectObject(pravougaonikpen);
CPoint* tacke = new CPoint[4];
tacke[0] = ::CPoint(rect.left+35,okvirni.top+15);
tacke[1] = ::CPoint(okvirni.left,okvirni.top);
tacke[2] = ::CPoint(okvirni.left,okvirni.bottom);
tacke[3] = ::CPoint(rect.left+35,okvirni.bottom+15);
pDC->Polygon(tacke,4);
pravougaonikpen.DeleteObject();
//linije sa strane
pDC->SelectStockObject(BLACK_PEN);
pDC->MoveTo(rect.left+35,rect.bottom -71 - 5*((okvirni.bottom-okvirni.top)/6)+10);
pDC->LineTo(okvirni.left,rect.bottom -71 - 5*((okvirni.bottom-okvirni.top)/6)-8);

pDC->MoveTo(rect.left+35,rect.bottom -71 - 4*((okvirni.bottom-okvirni.top)/6)+10);
pDC->LineTo(okvirni.left,rect.bottom -71 - 4*((okvirni.bottom-okvirni.top)/6)-8);

pDC->MoveTo(rect.left+35,rect.bottom -71 - 3*((okvirni.bottom-okvirni.top)/6)+10);
pDC->LineTo(okvirni.left,rect.bottom -71 - 3*((okvirni.bottom-okvirni.top)/6)-8);

pDC->MoveTo(rect.left+35,rect.bottom -71 - 2*((okvirni.bottom-okvirni.top)/6)+16);
pDC->LineTo(okvirni.left,rect.bottom -71 - 2*((okvirni.bottom-okvirni.top)/6)-4);

pDC->MoveTo(rect.left+35,rect.bottom -71 - ((okvirni.bottom-okvirni.top)/6)+16);
pDC->LineTo(okvirni.left,rect.bottom -71 - ((okvirni.bottom-okvirni.top)/6)-2);
//Donji cetvorougao
pDC->SelectStockObject(DKGRAY_BRUSH);
pDC->SelectStockObject(BLACK_PEN);
tacke[0] = ::CPoint(rect.left+35,okvirni.bottom+15);
tacke[1] = ::CPoint(okvirni.left,okvirni.bottom);
tacke[2] = ::CPoint(okvirni.right,okvirni.bottom);
tacke[3] = ::CPoint(rect.left+35+okvirni.right-okvirni.left,okvirni.bottom+15);
pDC->Polygon(tacke,4);
int vrednosti [] = {10, 15, 30, 44,33,12,99};
int duzina = sizeof(vrednosti)/sizeof(int);
    // stubovi;

    Nacrtaj(pDC,okvirni,vrednosti,duzina,255,255,255);

}

void Nacrtaj(CDC* pDC,CRect okvir,int vektor1[],int duzina,int R1,int G1,int B1){
int a = (okvir.bottom+okvir.bottom+15)/2;
CBrush stub(RGB(R1,G1,B1));
pDC->SelectObject(stub);
int j = 0;
int s = (okvir.right-okvir.left)/(duzina*3);
int raz = s*3/2;
int kor = raz;
while (j != duzina)
    {
        int v = vektor1[j]*(okvir.bottom-okvir.top)/100;
        int visina = okvir.bottom-v;
        ->Rectangle(okvir.left+kor,visina,okvir.left+s+kor,a);
        kor+=s+raz;
        j++;
    }

}

1 个答案:

答案 0 :(得分:3)

void Nacrtaj(CDC* pDC,CRect okvir,int vektor1[],int duzina,int R1,int G1,int B1)
{

应该是

void CDomaci1View::Nacrtaj(CDC* pDC,CRect okvir,int vektor1[],int duzina,int R1,int G1,int B1)
{

容易犯错误。