Hi all.
So, i'v been working for a while now in C++ Builder and had no need to define my on functions, until now.
I need a function to browse tree depth, it has to be able to appeal itself. But that's not the point.
My problem is if i declare my own function it does not recognize any objects (entities) that belong to the curent form (unit).
For example if i have the function:
void __fastcall TForm1::Button12Click(TObject *Sender)
i can make a reference to any other object on the form (z=Edit1->Text; h=Button12->Height; etc) and all works fine but if i try to define my own function, for example:
float CircleArea (radius);
int z;
z=StrToInt(Edit1->Text); //Random referince to object Edit1, for example.
area=3,14*(radius*radius)
return(area);
}
I get "Undefined symbol Edit1" error.
So my concluding question would be :
How do I declare my functions so they can recognize other objects of the form, just like the self declared ones ?
P.S. English is not my native language but i hope i explained very clear my problem ^^
P.P.S. I you have some knowledge about browsing trees in depth it would also be apreciated.
"Undefined symbols" error in user defined functions ! [C++ Builder 6]
Started by GlaDiuS, Apr 26 2010 12:30 PM
4 replies to this topic
#1
Posted 26 April 2010 - 12:30 PM
|
|
|
#2
Posted 30 April 2010 - 10:31 AM
I think I understand what you are talking about, but I'm not sure..
It's hard to guess what is wrong with so little code to work with, but it seems like Edit1 is a member of a class TForm1? I am not familiar with C++ Builder, so I'm not sure about the details here.
If that is the case, you might have to reference Edit1 through an instance of the class, but without more code it is hard to say. As I said I don't know how C++ Builder works.
It's hard to guess what is wrong with so little code to work with, but it seems like Edit1 is a member of a class TForm1? I am not familiar with C++ Builder, so I'm not sure about the details here.
If that is the case, you might have to reference Edit1 through an instance of the class, but without more code it is hard to say. As I said I don't know how C++ Builder works.
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
#3
Posted 30 April 2010 - 07:53 PM
That looks like Borland C++. You haven't come close to giving us enough code to debug. There are no headers, for example.
#4
Posted 01 May 2010 - 03:57 AM
1. Either you define that funtion as a member function of the TForm derivative that contains Edit1;
or
2. Refer to Edit1 with an object name, in your case, it could be Form1->Edit1. C++Builder uses a lot of global variable, if you open the header file for the form that contains Edit1, you should be able to find something like
extern ... TForm1 * Form1;
Form1 is the global variable that you can use to reference the form object.
or
2. Refer to Edit1 with an object name, in your case, it could be Form1->Edit1. C++Builder uses a lot of global variable, if you open the header file for the form that contains Edit1, you should be able to find something like
extern ... TForm1 * Form1;
Form1 is the global variable that you can use to reference the form object.
#5
Posted 01 May 2010 - 03:58 AM
BTW, marwex89 is right.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









