Jump to content

"Undefined symbols" error in user defined functions ! [C++ Builder 6]

- - - - -

  • Please log in to reply
4 replies to this topic

#1
GlaDiuS

GlaDiuS

    Newbie

  • Members
  • Pip
  • 1 posts
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.

#2
marwex89

marwex89

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 10,720 posts
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.
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
That looks like Borland C++. You haven't come close to giving us enough code to debug. There are no headers, for example.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#4
Lance

Lance

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 276 posts
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.

#5
Lance

Lance

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 276 posts
BTW, marwex89 is right.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users