[ILINK32 Error] Error: Unresolved external problem

Discussion in 'C' started by thnitos, Nov 27, 2009.

  1. thnitos

    thnitos New Member

    Joined:
    Oct 16, 2009
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    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;
     [COLOR=Black]find = new Find;[/COLOR] //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!
     
  2. Gene Poole

    Gene Poole New Member

    Joined:
    Nov 10, 2009
    Messages:
    93
    Likes Received:
    5
    Trophy Points:
    0
    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 [COLOR="Red"]Find::[/COLOR]editbox(AnsiString edit)
    {
     edit = Form1->Edit1->Text;
     Form1->Label1->Caption = edit;
    }
    
     
  3. thnitos

    thnitos New Member

    Joined:
    Oct 16, 2009
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    Thank you so much Gene Poole!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice