[ILINK32 Error] Error: Unresolved external problem

thnitos's Avatar, Join Date: Oct 2009
Light Poster
Hi there!
I,ve already write code in VC++ with the CodeGear 2009 platform.
But Lucky me they asked me to write it again with classes!
So i tryed and here is the problem.....

Find1.h
Code:
#ifndef Find_H
#define Find_H

#include <iostream>

using namespace std;
#include <stdio.h>
#include <stdlib.h>
class Find
{
 public:
         void editbox(AnsiString);
 private:

};//end of find class
#endif
Find1.cpp
Code:
#include <iostream>

using namespace std;
#include "Find1.h"
#include "Unit1.h"

void editbox(AnsiString edit)
{
 edit = Form1->Edit1->Text;
 Form1->Label1->Caption = edit;
}
main.cpp
#include <iostream>
#include <stdlib>
#include "Find1.h"
#include "Unit1.h"

void main ()
{
Form1->Show();
}

Unit1.cpp // this is the cpp file of my form
Code:
#include <vcl.h>
#include <iostream>
using namespace std;
#include <fstream>
#pragma hdrstop

#include "Unit1.h"
#include "Find1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
 AnsiString name;
 name = "George";
 Find *find;
 find = new Find; //line 1
 find->editbox(Form1->Edit1->Text) //problem line
}

So if i run it till line 1 it links well and i can run the programm
if i run it with the problem line i take this:

[ILINK32 Error] Error: Unresolved external 'Find::editbox(System::AnsiStringT<0>)' referenced from C:\USERS\GEORGE\DESKTOP\PROJECTS\CLASS TEST\DEBUG\UNIT1.OBJ


any idias........
Thanks for you're help!
0
Gene Poole's Avatar, Join Date: Nov 2009
Contributor
Editbox() is declared as a member of class Find. Your implementation of editbox() doesn't show that it is part of the Find class. Add this (in red):

Code:
#include <iostream>

using namespace std;
#include "Find1.h"
#include "Unit1.h"

void Find::editbox(AnsiString edit)
{
 edit = Form1->Edit1->Text;
 Form1->Label1->Caption = edit;
}
0
thnitos's Avatar, Join Date: Oct 2009
Light Poster
Thank you so much Gene Poole!