473,398 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

illegal call of non static function

Hi

I have a problem. I have a function :
void for3::drzewo() {

m_lista.DeleteAllItems();

m_li.GetImageList();

goi.GetImageCount();
goi.SetBkColor(RGB(0,0,0));
goi.Add(nowe_ikony.ExtractIcon(0));
goi.SetBkColor(RGB(0,0,0));
goi.Add(nowe_ikony.ExtractIcon(1));
goi.SetBkColor(RGB(0,0,0));
goi.Add(nowe_ikony.ExtractIcon(2));
goi.SetBkColor(RGB(0,0,0));
goi.Add(nowe_ikony.ExtractIcon(3));
goi.SetBkColor(RGB(0,0,0));
goi.Add(nowe_ikony.ExtractIcon(4));
goi.GetImageCount();

m_drzewo.SetImageList(&goi,TVSIL_NORMAL);
CString ciag;
utworz_roota("Dyski lokalne");
CString fff;
for (int h=0;h<32;h++) {
fff="";
if (tablica_dyskow[h]!='0') {
fff+=tablica_dyskow[h];
fff+=":";
fff.MakeUpper();
w_dol(fff);
szu_rek(fff);
}
else break;
}

doEnum(0,NULL);
m_drzewo.SortChildren(TVI_ROOT);

}

and I want to call that function from CMainFrm - when i push the button from
my menu.

When I try to do it like that:

void CMainFrame::OnDrzewo()
{

for3::drzewo();

}

This error was occured:

Illegal call of non static function. I know that i must call pointer to for3
but i don't know how.

Help

Taptu¶
Nov 17 '05 #1
3 2814
If you want to be able to call a function without creating an instance of
the object, you can simply put "static" in front of the function's
declaration. Otherwise, create an object like
for3 myobject;
myobject.drzewo;
"Taptu¶" <pu***@poczta.onet.pl> wrote in message
news:bv**********@nemesis.news.tpi.pl...
Hi

I have a problem. I have a function :
void for3::drzewo() {

m_lista.DeleteAllItems();

m_li.GetImageList();

goi.GetImageCount();
goi.SetBkColor(RGB(0,0,0));
goi.Add(nowe_ikony.ExtractIcon(0));
goi.SetBkColor(RGB(0,0,0));
goi.Add(nowe_ikony.ExtractIcon(1));
goi.SetBkColor(RGB(0,0,0));
goi.Add(nowe_ikony.ExtractIcon(2));
goi.SetBkColor(RGB(0,0,0));
goi.Add(nowe_ikony.ExtractIcon(3));
goi.SetBkColor(RGB(0,0,0));
goi.Add(nowe_ikony.ExtractIcon(4));
goi.GetImageCount();

m_drzewo.SetImageList(&goi,TVSIL_NORMAL);
CString ciag;
utworz_roota("Dyski lokalne");
CString fff;
for (int h=0;h<32;h++) {
fff="";
if (tablica_dyskow[h]!='0') {
fff+=tablica_dyskow[h];
fff+=":";
fff.MakeUpper();
w_dol(fff);
szu_rek(fff);
}
else break;
}

doEnum(0,NULL);
m_drzewo.SortChildren(TVI_ROOT);

}

and I want to call that function from CMainFrm - when i push the button from my menu.

When I try to do it like that:

void CMainFrame::OnDrzewo()
{

for3::drzewo();

}

This error was occured:

Illegal call of non static function. I know that i must call pointer to for3 but i don't know how.

Help

Taptu¶

Nov 17 '05 #2

U¿ytkownik "Michiel" <mi*********@RECLAMEpayvision.com> napisa³ w wiadomo¶ci
news:u2**************@TK2MSFTNGP09.phx.gbl...
If you want to be able to call a function without creating an instance of
the object, you can simply put "static" in front of the function's
declaration. Otherwise, create an object like
for3 myobject;
myobject.drzewo;

doesn't work :((((( lot of errors same as the firs one -> illegal call of
non static ............... in function drzewo() :(((((((

I don't want to change all codes. Is there any simple way ?
This id SDI Project. When I push button on MainFrame Menu the function from
class for3 schould be started.
Taptu¶
Nov 17 '05 #3
You _declared_ the function as "static void drzewo()" in the header file ?

"Taptu¶" <pu***@poczta.onet.pl> wrote in message
news:bv**********@atlantis.news.tpi.pl...

U¿ytkownik "Michiel" <mi*********@RECLAMEpayvision.com> napisa³ w wiadomo¶ci news:u2**************@TK2MSFTNGP09.phx.gbl...
If you want to be able to call a function without creating an instance of the object, you can simply put "static" in front of the function's
declaration. Otherwise, create an object like
for3 myobject;
myobject.drzewo;

doesn't work :((((( lot of errors same as the firs one -> illegal call of
non static ............... in function drzewo() :(((((((

I don't want to change all codes. Is there any simple way ?
This id SDI Project. When I push button on MainFrame Menu the function

from class for3 schould be started.
Taptu¶

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: rob | last post by:
Dear All, I am getting an error "Illegal cross-thread operation". I am not creating any threads. I know internally there are many threads running, though. Does that mean that no form can call a...
7
by: Ook | last post by:
What am I doing wrong? This code gives a compile error: 'SortedList<T>::insert' : illegal call of non-static member function. I've tried several variations of this, but keep getting the same error....
5
by: Dave | last post by:
I need to cut out illegal characters in a string submitted from a mobile phone to a web form. I need a way to check for the illegal characters in a textbox. I intend to loop through the text and...
2
by: Gabrielle A. Grün | last post by:
Hi All, Does anyone know a way around the illegal reference of a non-static member? Thanks. iNHERITANCE HIERACY
3
by: stain | last post by:
hi, the following code produces an "illegal explicit template specialization" warning. I have been fiddling around a while to find a solution to specialize a template method of a specialized...
2
by: hhhh | last post by:
I am facig a problem.. this is the basic structure of my code. #define @#problem() aaa::fn() class aaa { fn(); } this is aaa.h
10
by: shanknbake | last post by:
I'm getting the following compile-time error: error C2352: 'Person::getCount' : illegal call of non-static member function Here is my getCount function declaration:...
2
by: SpecialKay | last post by:
Im getting this error when i try to make a call to a function, from inside an event hook. Anyone have some suggestion on things to try? thanks a lot
2
by: Kamaria | last post by:
I wrote this program to calculate the income tax of a user depending on whether or not they were married: import javax.swing.JOptionPane; public class Income_Tax { public static void main...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.