المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : error C2227: left of '->arr' must point to class/struct/union/generic type, but works



C++ Programming
04-07-2009, 06:16 PM
okay I've created a program that has a 2D array that I want to display and edit. The class I created is called CChannel.

I'm using SDI to display it, in the View class I have defined this,
m_pChans = GetDocument()->GetChan();

m_chan is defined, CChannel m_chan;
GetChan() is this.

CChannel* GetChan() {
return &m_chan;
}

CChannel has an array defined in it called,
int arr[16][3600];

Okay, so within my View file I run the lines,
m_pChans->arr[i][j]=1;
that works fine and updates the array good, but when I copy this code in a function then try call it called from another file I get problems. First it asks me to make that function static, I'm not sure why,

error C2352: 'CUCPView::UpdateOutputs' : illegal call of non-static member function

so I make the function static, then it has this error,

error C2227: left of '->arr' must point to class/struct/union/generic type

I don't understand why it works within View, but when I try to use it in a function and make it static it doesn't work. I've been trying to look up the error codes and such, but with no luck. Could someone please help me with this.

I'll post more code if needed, but this already is pretty long
Cheers